Programmatically create a ConsoleAppender
Dear all, I have a test-case where I want to add extra logging compared to my normal logging settings. I have therefore create manually an appender, and add that to a logger. However, PRIORITY.DEBUG is deprecated. I am probably missing some information about how to add extra logging: private final val mockRealTimeLogger= Logger.getLogger(MockRealTimeConnectorLogger) mockRealTimeLogger.setLevel(Level.DEBUG) val appender = new ConsoleAppender(new PatternLayout(%d{ABSOLUTE} [%t] %-5p %c{1} - %m%n)); appender.setThreshold(Priority.DEBUG) mockRealTimeLogger.addAppender(appender) Isn't this good? Thank you very much Edmondo Porcu Associate - Financial software architect Avenue de Rhodanie 48 1007 Lausanne Switzerland. Dir +41 (0) 21 560 30 82 Fax +41 (0) 21 617 71 55 Email : edmondo.po...@gottexbrokers.com The information in this email is confidential and may be legally privileged. If you are not the intended recipient, you must not read, use or disseminate the information. Although this email and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by the Gottex Group of Companies for any loss or damage arising in any way from its use. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
log4j rollover in est timezone not working as expected
Initially I setup log4j to rollover at midnight using the default machine (linux) timezone which is GMT and everything worked correctly. I could see the timestamps before and after rollover were correct. I then changed the time output to be in EST (log4j extras) but the rollover still happens at midnight GMT or 5 hours too early. How can I get both time display and rollover to work the same based on EST? This is my current test property file: log4j.appender.appender1=org.apache.log4j.DailyRollingFileAppender log4j.appender.appender1.File=report.log log4j.appender.appender1.layout=org.apache.log4j.EnhancedPatternLayout log4j.appender.appender1.layout.conversionPattern=%d{-MM-dd HH:mm:ss.SSS}{EST} [%p] %c:%L - %m%n log4j.appender.appender1.DatePattern = '.'-MM-dd-HH-mm When I look in the log file I can see the entries are in EST - so far so good. But when I look at the last entry before rollover, I see: INFO 2012-02-09 18:56:06 ... so, we have a rollover around 7pm EST or midnight GMT but I want the rollover to happen at midnight EST or 5 hours later. Right now the day boundaries are showing across two files which makes troubleshooting application errors more difficult. BTW, I'm using the 1.2.16 log4j binary and 1.1 extras. thanks, Paul. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: Programmatically create a ConsoleAppender
Level is the new Priority, just as Logger is the new Category. Try Level.DEBUG. Jake On Mon, 13 Feb 2012 09:31:03 + Edmondo Porcu edmondo.po...@gottexbrokers.com wrote: Dear all, I have a test-case where I want to add extra logging compared to my normal logging settings. I have therefore create manually an appender, and add that to a logger. However, PRIORITY.DEBUG is deprecated. I am probably missing some information about how to add extra logging: private final val mockRealTimeLogger= Logger.getLogger(MockRealTimeConnectorLogger) mockRealTimeLogger.setLevel(Level.DEBUG) val appender = new ConsoleAppender(new PatternLayout(%d{ABSOLUTE} [%t] %-5p %c{1} - %m%n)); appender.setThreshold(Priority.DEBUG) mockRealTimeLogger.addAppender(appender) Isn't this good? Thank you very much Edmondo Porcu Associate - Financial software architect Avenue de Rhodanie 48 1007 Lausanne Switzerland. Dir +41 (0) 21 560 30 82 Fax +41 (0) 21 617 71 55 Email : edmondo.po...@gottexbrokers.com The information in this email is confidential and may be legally privileged. If you are not the intended recipient, you must not read, use or disseminate the information. Although this email and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by the Gottex Group of Companies for any loss or damage arising in any way from its use. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
RE: Programmatically create a ConsoleAppender
But I can't pass Level.DEBUG to appender.setThreshold...right? Best Regards Edmondo Edmondo Porcu Financial software architect Avenue de Rhodanie 48 1007 Lausanne Switzerland. Dir +41 (0) 21 560 30 82 Fax +41 (0) 21 617 71 55 Email : edmondo.po...@gottexbrokers.com The information in this email is confidential and may be legally privileged. If you are not the intended recipient, you must not read, use or disseminate the information. Although this email and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by the Gottex Group of Companies for any loss or damage arising in any way from its use. -Original Message- From: Jacob Kjome [mailto:h...@visi.com] Sent: lunedì, febbraio 13, 2012 6:32 PM To: Log4J Users List Subject: Re: Programmatically create a ConsoleAppender Level is the new Priority, just as Logger is the new Category. Try Level.DEBUG. Jake On Mon, 13 Feb 2012 09:31:03 + Edmondo Porcu edmondo.po...@gottexbrokers.com wrote: Dear all, I have a test-case where I want to add extra logging compared to my normal logging settings. I have therefore create manually an appender, and add that to a logger. However, PRIORITY.DEBUG is deprecated. I am probably missing some information about how to add extra logging: private final val mockRealTimeLogger= Logger.getLogger(MockRealTimeConnectorLogger) mockRealTimeLogger.setLevel(Level.DEBUG) val appender = new ConsoleAppender(new PatternLayout(%d{ABSOLUTE} [%t] %-5p %c{1} - %m%n)); appender.setThreshold(Priority.DEBUG) mockRealTimeLogger.addAppender(appender) Isn't this good? Thank you very much Edmondo Porcu Associate - Financial software architect Avenue de Rhodanie 48 1007 Lausanne Switzerland. Dir +41 (0) 21 560 30 82 Fax +41 (0) 21 617 71 55 Email : edmondo.po...@gottexbrokers.com The information in this email is confidential and may be legally privileged. If you are not the intended recipient, you must not read, use or disseminate the information. Although this email and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by the Gottex Group of Companies for any loss or damage arising in any way from its use. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org __ This email has been scanned by the Symantec Email Security.cloud service. For more information please visit http://www.symanteccloud.com __ - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: Programmatically create a ConsoleAppender
Did you try compiling and it failed? That would be odd. Level is a Priority [1], so setThreshold(Priority) should accept a Level. [1] http://logging.apache.org/log4j/1.2/apidocs/index.html?org/apache/log4j/Level.html Jake On Mon, 13 Feb 2012 19:14:22 + Edmondo Porcu edmondo.po...@gottexbrokers.com wrote: But I can't pass Level.DEBUG to appender.setThreshold...right? Best Regards Edmondo Edmondo Porcu Financial software architect Avenue de Rhodanie 48 1007 Lausanne Switzerland. Dir +41 (0) 21 560 30 82 Fax +41 (0) 21 617 71 55 Email : edmondo.po...@gottexbrokers.com The information in this email is confidential and may be legally privileged. If you are not the intended recipient, you must not read, use or disseminate the information. Although this email and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by the Gottex Group of Companies for any loss or damage arising in any way from its use. -Original Message- From: Jacob Kjome [mailto:h...@visi.com] Sent: lunedì, febbraio 13, 2012 6:32 PM To: Log4J Users List Subject: Re: Programmatically create a ConsoleAppender Level is the new Priority, just as Logger is the new Category. Try Level.DEBUG. Jake On Mon, 13 Feb 2012 09:31:03 + Edmondo Porcu edmondo.po...@gottexbrokers.com wrote: Dear all, I have a test-case where I want to add extra logging compared to my normal logging settings. I have therefore create manually an appender, and add that to a logger. However, PRIORITY.DEBUG is deprecated. I am probably missing some information about how to add extra logging: private final val mockRealTimeLogger= Logger.getLogger(MockRealTimeConnectorLogger) mockRealTimeLogger.setLevel(Level.DEBUG) val appender = new ConsoleAppender(new PatternLayout(%d{ABSOLUTE} [%t] %-5p %c{1} - %m%n)); appender.setThreshold(Priority.DEBUG) mockRealTimeLogger.addAppender(appender) Isn't this good? Thank you very much Edmondo Porcu Associate - Financial software architect Avenue de Rhodanie 48 1007 Lausanne Switzerland. Dir +41 (0) 21 560 30 82 Fax +41 (0) 21 617 71 55 Email : edmondo.po...@gottexbrokers.com The information in this email is confidential and may be legally privileged. If you are not the intended recipient, you must not read, use or disseminate the information. Although this email and any attachments are believed to be free of any virus or other defect that might affect any computer system into which it is received and opened, it is the responsibility of the recipient to ensure that it is virus free and no responsibility is accepted by the Gottex Group of Companies for any loss or damage arising in any way from its use. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org __ This email has been scanned by the Symantec Email Security.cloud service. For more information please visit http://www.symanteccloud.com __ - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org