From: Tod H. <th...@gi...> - 2004-10-15 14:14:20
|
OK, basically what I have is mod_perl handlers, so its a bit tough to call it a 'program', there is no main application. I'll try to condense it down to an example handler that should be easy to look at. The environment is: Mandrake Linux 10.0 official Apache 2.0.50 Perl 5.8.5 mod_perl 1.99_16 Log::Log4perl 0.48 The attached files are: init.pl - PerlRequired script, this runs at server startup and inits Log4perl and loads MyTest.pm MyTest.pm - simple modperl handler logging.conf - sample logging configuration vhost.conf - Apache configuration that runs all of this mess The behaviour I get with the test is exactly consistent with my application. I have 1 appender which I use SYNCER, so everything goes to one log file. It appears that if I set up category 'MyTest' to 'DEBUG' then even if rootLogger is 'FATAL' I get the messages from MyTest and MyTest.detail, which is what I would expect (assuming they are both set at level 'DEBUG'). But if I set MyTest to 'INFO' I don't even get the informational message logged at that category at level INFO!!! And I certainly never get level MyTest.detail unless MyTest is at DEBUG. It appears that get_logger() ignores its argument and just uses package names as categories all the time. The problem is this means I can either get a giant blast of every debugging message my application could possibly generate (some of the packages are fairly extensive) or NOTHING. Furthermore even if get_logger() does ignore its argument I should STILL get the INFO level message put out at category MyTest!!! Why do I have to set a level of DEBUG for MyTest just to see an INFO level message???!!! Its all making my head hurt. ;) Thanks for getting back to me. Let me know if you see anything in my setup that explains all this, Thanks again! Tod Harter, TradeDesk Software On Thu, 14 Oct 2004, Tod Harter wrote: >> My configuration file... Can you also provide a code sample? Ideally, a test case of what you're seeing and what you're expecting. >> I've also discovered that if you set your rootLogger to say 'INFO' and >> lower levels of the heirarchy to 'DEBUG', you NEVER get anything except >> 'INFO' >> level and lower from ANY part of the heirarchy. This seems to be in >> direct contradiction of the manual and tutorials. In this case, you'll get INFO messages in the root logger and DEBUG messages in the 'lower levels of the hierarchy' as you've defined. Example: use Log::Log4perl qw(get_logger); my $conf = q( log4perl.rootLogger = INFO, Screen log4perl.category.Bar.Twix = DEBUG, Screen log4perl.appender.Screen = Log::Log4perl::Appender::Screen log4perl.appender.Screen.layout = Log::Log4perl::Layout::SimpleLayout ); Log::Log4perl::init(\$conf); my $logger = get_logger("Bar::Twix"); $logger->debug("Blah"); prints two messages, one from each logger: DEBUG - Blah DEBUG - Blah Can you provide a test case if you're seeing anything suspicious? -- Mike Mike Schilli m...@pe... |