[log4perl-devel] logging to different files and file rotation
Hi there, What I'm trying to do here is: 1. log WARN to mainLogFile 2. log DEBUG to runMonitorLogFile 3. output to screen at level INFO 4. email at level WARN and here is the log4per.properties file: #predefined variables layout_class = Log::Log4perl::Layout::PatternLayout layout_pattern = %d %5p %F{1} %L> %m %n layout_email_pattern = %d{-MM-dd HH:mm:ss} [%F{1}:%c{1}:%L] %5p> %m%n log_file_appender = Log::Dispatch::FileRotate log4perl.logger.main = WARN, MainLogfile, Email log4perl.logger.main.runMonitorStage = DEBUG, RunMonitorLogFile, Screen 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 = -MM-dd log4perl.appender.MainLogfile.TZ = PST log4perl.appender.MainLogfile.layout = ${layout_class} log4perl.appender.MainLogfile.layout.ConversionPattern = ${layout_pattern} #Run Monitor Stage Log log4perl.appender.RunMonitorLogFile = ${log_file_appender} log4perl.appender.RunMonitorLogFile.filename = logs/runmonitor.log log4perl.appender.RunMonitorLogFile.mode = append log4perl.appender.RunMonitorLogFile.max = 5 log4perl.appender.RunMonitorLogFile.DatePattern = -MM-dd log4perl.appender.RunMonitorLogFile.TZ = PST log4perl.appender.RunMonitorLogFile.layout = ${layout_class} log4perl.appender.RunMonitorLogFile.layout.ConversionPattern = ${layout_pattern} #log4perl general screen output configuration log4perl.appender.Screen= Log::Log4perl::Appender::Screen log4perl.appender.Screen.stderr = 0 log4perl.appender.Screen.layout = ${layout_class} log4perl.appender.Screen.layout.ConversionPattern = ${layout_pattern} log4perl.appender.Screen.Threshold = INFO #SPP event EMAIL output configuration log4perl.appender.Email = Log::Dispatch::Email::MailSender log4perl.appender.Email.subject = sub { return getEmailSubject(); } #log4perl.appender.Email.subject = %F{1} log4perl.appender.Email.name = SPP event log4perl.appender.Email.to = dav...@mail.com log4perl.appender.Email.from = davidz@ mail.com log4perl.appender.Email.smtp = mail.com log4perl.appender.Email.min_level = warning log4perl.appender.Email.buffered = 0 log4perl.appender.Email.layout = ${layout_class} log4perl.appender.Email.layout.ConversionPattern = ${layout_email_pattern} With this setup, I can achieve all of above intended, except for the DEBUG logging is directed to mail.log instead of runmonitor.log. With log4perl.appender.MainLogfile.Threshold = WARN specified, no DEBUG level log to either logs. Where do I set up wrong here? Thanks in advance! David -- Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
[log4perl-devel] Log::Dispatch::FileRotate not working with "append" mode?
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{-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 = -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 -- Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel
Re: [log4perl-devel] Log::Dispatch::FileRotate not working with "append" mode?
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 wrote: > On Tue, 17 Feb 2009, wzhao6...@gmail.com 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...@perlmeister.com > > > 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{-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 = -MM-dd >> log4perl.appender.MainLogfile.TZ = PST >> log4perl.appender.MainLogfile.layout = ${layout_class} >> log4perl.appender.MainLogfile.layout.ConversionPattern = ${layout_pattern} >> >> -- Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H___ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel