From: Mike S. <m...@pe...> - 2004-09-14 16:12:59
|
Aldrich, Timothy wrote on 9/14/2004, 8:20 AM: > Now I would like to add logging to a different file that get's > appended to during the day. This new rolling log needs different > information. It should be general status messages . i.e. program > started , ended , by whom. My question is , what is the best way to > implement this additional log ? > I could : > * Pollute my program with print statements (shudder) Shudder, indeed :). > * Add a new Log::log4perl category. Categories determine where a message came from within the system, not where it's going to, so I'd recommend leaving them untouched for what you're trying to accomplish. > * add a Log::log4perl filter If you want different kinds of messages to go to different output sinks, log levels are the recommended way. In your case, you could log the debug messages like $logger->debug("a lowlevel message"); and important events, like when the program started, stopped, etc., via $logger->info("Program started"); Then, use http://log4perl.sourceforge.net/d/Log/Log4perl/FAQ.html#c7fa8 to channel messages of different priorities to different log files. -- -- Mike Mike Schilli m...@pe... |