Hi all,

I am new with log4perl.

 

I am testing it and it looks like it is working OK.  I am wondering if it is 
possible to do what I want to with it.  I want, when the file rotate every day 
to change the file name to include the date in the file name?

 

My config file is like that :

 

layout_class = Log::Log4perl::Layout::PatternLayout

layout_pattern = %d %p> %F{1}:%L %M - %m%n

 

log4perl.logger = FATAL, Screen

log4perl.logger.Groceries.Food = DEBUG, Log

 

log4perl.appender.Screen = Log::Dispatch::Screen

log4perl.appender.Screen.stderr = 0

log4perl.appender.Screen.Threshold = DEBUG

log4perl.appender.Screen.layout = ${layout_class}

log4perl.appender.Screen.layout.ConversionPattern = ${layout_pattern}

 

log4perl.appender.Log = Log::Dispatch::FileRotate

log4perl.appender.Log.filename = sub { return getLogFilename(); }

log4perl.appender.Log.mode = append

log4perl.appender.Log.DatePattern = yyyy-MM-dd

log4perl.appender.Log.max = 2

log4perl.appender.Log.layout = ${layout_class}

log4perl.appender.Log.layout.ConversionPattern = ${layout_pattern}

 

and the getLogFilename is a sub that format the file name like yyyyMMdd.test.log

 

But like I read in the documentation, the sub are executed only once at the 
time the config file is read.  So the date in the file name is always the date 
when I start the program.

 

 

Is there a way to roll the file and changing the file name at roll time?

 

Thank,

__________________________________________

Belleville, Luc

Analyste principal - gestion de système

Bell Solutions d'impartition en TIC

505 de Maisonneuve O., 1er étage

Montréal, Québec, H3A 3C2

Tel : (514) 499-3512

Fax : (514) 499-3577

Pagette : (514) 749-8045

[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 

 

 

 

<<image001.gif>>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
log4perl-devel mailing list
log4perl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/log4perl-devel

Reply via email to