From: Mike S. <msc...@ao...> - 2003-12-13 04:13:44
|
Marco Aurelio Valtas Cunha wrote on 12/12/2003, 2:24 AM: > I was thinking in have one file for each > Adaptor, but this means write one more Appender configuration for each > Adaptor. > But I expect more and more Adaptors and as a programmer I'm very lazy, > the > result I want is that each new adaptor added in my conf file will > imply a nre > log file with it's name. The file appenders that come with Log::Log4perl and Log::Dispatch require that the name of the file they're logging to is specified as a property -- this leaves you with the manual approach: Define an appender for every file and assign each of them to a different logger (but watch out for messages bubbling up, see the FAQ). If you want to automate the creation of these appenders, you could (somewhat at the expense of the maintainability of your script/config file) leave your config file like it is and use l4p's add_appender() method in your code like this: my $logger = Log::Log4perl->get_logger("My.Component"); $logger->add_appender($app); to add a previously defined appender $app to this logger. Or, you could automate creating the l4p conf file with a script. -- -- Mike Mike Schilli m...@pe... |