|
From: Mike S. <m...@pe...> - 2004-08-24 17:34:22
|
Lee Carmichael wrote on 8/24/2004, 6:25 AM:
> There has been a request by our
> ops folks to make the logs use a daily date format.
Hmm, it looks like your requirement of a log file name based on the
current date could be met by the "Rolling File Appender", see this FAQ:
http://log4perl.sourceforge.net/d/Log/Log4perl/FAQ.html#923b3
However, if you still want to derive a class from L4p::Appender::File
(or from your directory class), here's a couple of comments:
Currently, there's two different methods in Log::Log4perl::Appender::File
which are setting/modifying the filename: The constructor new()
and the switch_file() method. Both take the file name as a parameter.
Changing the internal {filename} attribute has no effect, it won't log
to a different file unless switch_file() is called.
So, I would recommend that the derived class doesn't override
file_open() or filename(), but comes with its own constructor, calling
the base class constructor with the desired file name. If you need to
switch the name during runtime, I suggest overriding log() and using
switch_file() if desired. Would this be an option?
--
-- Mike
Mike Schilli
m...@pe...
|