[log4perl-devel] Configuration question

2008-07-16 Thread Johannes Kilian
Hi,

probably a simple question, but I cannot figure it out:

I have configured a logger for category "Test" to log all DEBUG messages - but 
for one child-category "Test.child1" I only want the INFO messages.

What I tried is:
---
log4j.logger.Test=DEBUG, MyFileAppender
log4j.logger.Test.Child1=INFO, MyFileAppender

log4j.additivity.Test=true
log4j.additivity.Test.Child1=false
---
but this didn't work 

How to achieve my goal?

Johannes




-- 
Pt! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
log4perl-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/log4perl-devel


Re: [log4perl-devel] Configuration question

2008-07-16 Thread Mike Schilli
On Wed, 16 Jul 2008, Johannes Kilian wrote:

> probably a simple question, but I cannot figure it out:
>
> I have configured a logger for category "Test" to log all DEBUG messages - 
> but for one child-category "Test.child1" I only want the INFO messages.
>
> What I tried is:
> ---
> log4j.logger.Test=DEBUG, MyFileAppender
> log4j.logger.Test.Child1=INFO, MyFileAppender
>
> log4j.additivity.Test=true
> log4j.additivity.Test.Child1=false

Looks good to me:

use Log::Log4perl qw(:easy);
Log::Log4perl->init(\ q{
 log4j.logger.Test=DEBUG, Screen
 log4j.logger.Test.Child1=INFO, Screen

 log4j.additivity.Test=true
 log4j.additivity.Test.Child1=false
 log4j.appender.Screen = Log::Log4perl::Appender::Screen
 log4j.appender.Screen.layout = SimpleLayout
});

get_logger("Test")->debug("test debug log");
get_logger("Test")->info("test info log");

get_logger("Test::Child1")->debug("child1 debug log");
get_logger("Test::Child1")->info("child1 info log");

yields

DEBUG - test debug log
INFO - test info log
INFO - child1 info log

Isn't that what you'd expect?

-- Mike

Mike Schilli
[EMAIL PROTECTED]

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
log4perl-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/log4perl-devel