From: <wzh...@gm...> - 2009-02-17 18:17:27
|
Hi there, Here is my log4perl.properties file: #predefined variables layout_class = Log::Log4perl::Layout::PatternLayout layout_pattern = %d %5p %F{1} %L> %m %n layout_email_pattern = %d{yyyy-MM-dd HH:mm:ss} [%F{1}:%c{1}:%L] %5p> %m%n log_file_appender = Log::Dispatch::FileRotate #log4perl category log4perl.logger.main = WARN, MainLogfile, Email log4perl.appender.MainLogfile = Log::Dispatch::FileRotate log4perl.appender.MainLogfile.filename = main.log log4perl.appender.MainLogfile.mode = append log4perl.appender.MainLogfile.max = 5 log4perl.appender.MainLogfile.DatePattern = yyyy-MM-dd log4perl.appender.MainLogfile.TZ = PST log4perl.appender.MainLogfile.layout = ${layout_class} log4perl.appender.MainLogfile.layout.ConversionPattern = ${layout_pattern} I'd like the main.log to rotate at midnight, and persist among restarts (log file not wiped out among restarts) so I used "append" mode here, but the rotation is not working, did I set this up wrong? Thanks in advance! David |
From: Mike S. <m...@pe...> - 2009-02-18 00:41:55
|
On Tue, 17 Feb 2009, wzh...@gm... wrote: > I'd like the main.log to rotate at midnight, and persist among > restarts (log file not wiped out among restarts) so I used "append" > mode here, but the rotation is not working, did I set this up wrong? > Thanks in advance! Can you specify what exactly isn't working? Note that the rotation will only happen if you're writing a message. Also, if you're not sure if it's working correctly, use a shorter rotation interval (e.g. every minute) to create a test case you can verify quickly. -- Mike Mike Schilli m...@pe... > Hi there, Here is my log4perl.properties file: #predefined variables > layout_class = Log::Log4perl::Layout::PatternLayout layout_pattern > = %d %5p %F{1} %L> %m %n layout_email_pattern = %d{yyyy-MM-dd > HH:mm:ss} [%F{1}:%c{1}:%L] %5p> %m%n log_file_appender > = Log::Dispatch::FileRotate > > #log4perl category > log4perl.logger.main = WARN, MainLogfile, Email > > log4perl.appender.MainLogfile = Log::Dispatch::FileRotate > log4perl.appender.MainLogfile.filename = main.log > log4perl.appender.MainLogfile.mode = append > log4perl.appender.MainLogfile.max = 5 > log4perl.appender.MainLogfile.DatePattern = yyyy-MM-dd > log4perl.appender.MainLogfile.TZ = PST > log4perl.appender.MainLogfile.layout = ${layout_class} > log4perl.appender.MainLogfile.layout.ConversionPattern = ${layout_pattern} > |
From: <wzh...@gm...> - 2009-02-18 16:52:35
|
I have a script running, which can be stopped and restarted frequently. I was able to get the file rotation working until I added "log4perl.appender.RunMonitorLogFile.mode = append" to set the mode to append, so the previous script run's log file doesn't get wiped out after a restart of the script. It's not rotating anymore. What I want is: continuous logging, and log rotation at midnight.Thanks for your help! David On Tue, Feb 17, 2009 at 4:41 PM, Mike Schilli <m...@pe...> wrote: > On Tue, 17 Feb 2009, wzh...@gm... wrote: > > I'd like the main.log to rotate at midnight, and persist among >> restarts (log file not wiped out among restarts) so I used "append" >> mode here, but the rotation is not working, did I set this up wrong? >> Thanks in advance! >> > > Can you specify what exactly isn't working? > > Note that the rotation will only happen if you're writing a message. > > Also, if you're not sure if it's working correctly, use a shorter > rotation interval (e.g. every minute) to create a test case you can > verify quickly. > > -- Mike > > Mike Schilli > m...@pe... > > > Hi there, Here is my log4perl.properties file: #predefined variables >> layout_class = Log::Log4perl::Layout::PatternLayout layout_pattern >> = %d %5p %F{1} %L> %m %n layout_email_pattern = %d{yyyy-MM-dd >> HH:mm:ss} [%F{1}:%c{1}:%L] %5p> %m%n log_file_appender >> = Log::Dispatch::FileRotate >> >> #log4perl category >> log4perl.logger.main = WARN, MainLogfile, Email >> >> log4perl.appender.MainLogfile = Log::Dispatch::FileRotate >> log4perl.appender.MainLogfile.filename = main.log >> log4perl.appender.MainLogfile.mode = append >> log4perl.appender.MainLogfile.max = 5 >> log4perl.appender.MainLogfile.DatePattern = yyyy-MM-dd >> log4perl.appender.MainLogfile.TZ = PST >> log4perl.appender.MainLogfile.layout = ${layout_class} >> log4perl.appender.MainLogfile.layout.ConversionPattern = ${layout_pattern} >> >> |
From: Mike S. <m...@pe...> - 2009-02-20 05:41:41
|
On Wed, 18 Feb 2009, wzh...@gm... wrote: > I have a script running, which can be stopped and restarted frequently. I > was able to get the file rotation working until I added > "log4perl.appender.RunMonitorLogFile.mode = append" to set the mode to > append, so the previous script run's log file doesn't get wiped out after a > restart of the script. It's not rotating anymore. Works for me. Here's a script for you to verify, call it a couple of times, then wait a minute, and call it again, and you'll see that it'll create test.log.1, test.log.2 etc. use strict; use Log::Log4perl qw(get_logger); my $conf = q( log4perl.category.Bar.Twix = WARN, Logfile log4perl.appender.Logfile = Log::Dispatch::FileRotate log4perl.appender.Logfile.filename = test.log log4perl.appender.Logfile.mode = append log4perl.appender.Logfile.DatePattern = yyyy-MM-dd-HH-MM log4perl.appender.Logfile.max = 5 log4perl.appender.Logfile.layout = \ Log::Log4perl::Layout::PatternLayout log4perl.appender.Logfile.layout.ConversionPattern = %d %m %n ); Log::Log4perl::init(\$conf); my $logger = get_logger("Bar::Twix"); $logger->error("Blah"); Try it out! -- Mike Mike Schilli m...@pe... |