logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Serodio <dan...@checkforte.com.br>
Subject RE: additivity in PropertyConfigurator
Date Wed, 22 Jan 2003 21:55:39 GMT
Shouldn't PropertyConfiguration report this as an error?

[]'s
Daniel Serodio

On Wed, 2003-01-22 at 17:43, Ebersole, Steven wrote:
> additivity is an attribute of the logger/category, not the appender...
> 
> 
> As such, instead of:
>     log4j.category.com.printrak.me4=DEBUG, R4
>     log4j.additivity.R4=false
> you want:
>     log4j.category.com.printrak.me4=DEBUG, R4
>     log4j.aditivity.com.printrak.me4=false
> 
> 
> 
> 
>     |-----Original Message-----
>     |From: Evans Mark-PT1167 [mailto:Mark.Evans@motorola.com]
>     |Sent: Wednesday, January 22, 2003 1:12 PM
>     |To: 'Log4J Users List'
>     |Subject: additivity in PropertyConfigurator
>     |
>     |
>     |I need help setting the additivity in my log4j properties 
>     |file.  (It doesn't seem to be working for me.)  
>     |
>     |I want to log a specific class (logger) to one file, (and 
>     |in my example below log a second class (logger) to another 
>     |file), while logging the rest of my classes to a third 
>     |file (root logger).
>     |
>     |I'm using a PropertyConfigurator.  However, when I set 
>     |"additivity" on my category, per documentation, I still 
>     |get all messages going to the root logger's file.
>     |
>     |I'm following the example at 
>     |http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/P
>     |ropertyConfigurator.html
>     |
>     |which shows:
>     |log4j.additivity.SECURITY=false 
>     |
>     |Additional additivity information is found at 
>     |http://jakarta.apache.org/log4j/docs/manual.html#additivity
>     |
>     |where it states:
>     |
>     |	Appender Additivity 
>     |		The output of a log statement of logger C will 
>     |go to all the appenders in C and its ancestors. This is 
>     |the meaning of the term "appender additivity". 
>     |		However, if an ancestor of logger C, say P, has 
>     |the additivity flag set to false, then C's output will be 
>     |directed to all the appenders in C and it's ancestors upto 
>     |and including P but not the appenders in any of the 
>     |ancestors of P. 
>     |		Loggers have their additivity flag set to true 
>     |by default. 
>     |which  imply that the ancestor "P", when his additivity is 
>     |set to false, STILL logs messages, but doesn't pass them 
>     |to the parent.  So, I guess if you set additivity on your 
>     |logger "C", C messages will be logged, but not passed up 
>     |to parents.  (I think that's what I'm doing...)
>     |
>     |Here's the details, thanks for any help.  --Mark
>     |
>     |
>     |
>     |
>     |I'm logging logger3 to log4j.3.log.
>     |I'm logging logger4 to log4j.4.log.
>     |I'm logging the root category to log4j.log (here are the 
>     |messages I believe don't belong.)
>     |
>     |Code:
>     |...
>     |        static Category logger3 = 
>     |Category.getInstance("com.printrak.me3");
>     |        static Category logger4 = 
>     |Category.getInstance("com.printrak.me4");
>     |...
>     |	PropertyConfigurator.configure("log4j.properties");
>     |
>     |
>     |	logger3.debug("This is debug to logger3/me3.");
>     |	logger4.debug("This is debug to logger4/me4.");
>     |...
>     |
>     |
>     |log4j.3.log:
>     |2003-01-22 11:00:14,896 DEBUG [main] - This is debug to 
>     |logger3/me3.
>     |
>     |log4j.4.log:
>     |2003-01-22 11:00:14,906 DEBUG [main] - This is debug to 
>     |logger4/me4.
>     |
>     |log4j.log: (why are these here with additivity set to false?)
>     |2003-01-22 11:00:14,896 DEBUG [main] - This is debug to 
>     |logger3/me3.
>     |2003-01-22 11:00:14,906 DEBUG [main] - This is debug to 
>     |logger4/me4.
>     |
>     |
>     |Configuration file:
>     |
>     |log4j.rootCategory=WARN, R
>     |  
>     |log4j.category.com.printrak.me3=DEBUG, R3
>     |log4j.category.com.printrak.me4=DEBUG, R4
>     |
>     |log4j.category.com.printrak=DEBUG
>     |
>     |# Pattern to output the caller's file name and line number.
>     |
>     |log4j.appender.R=org.apache.log4j.FileAppender
>     |log4j.appender.R.File=log4j.log
>     |og4j.appender.R.layout=org.apache.log4j.PatternLayout
>     |log4j.appender.R.layout.ConversionPattern=%d %5p [%t] - %m%n
>     |
>     |log4j.appender.R3=org.apache.log4j.FileAppender
>     |log4j.appender.R3.File=log4j.3.log
>     |log4j.appender.R3.layout=org.apache.log4j.PatternLayout
>     |log4j.appender.R3.layout.ConversionPattern=%d %5p [%t] - %m%n
>     |log4j.additivity.R3=false
>     |
>     |log4j.appender.R4=org.apache.log4j.FileAppender
>     |log4j.appender.R4.File=log4j.4.log
>     |#log4j.appender.R4.DatePattern='.'yyyy-MM-dd
>     |log4j.appender.R4.layout=org.apache.log4j.PatternLayout
>     |log4j.appender.R4.layout.ConversionPattern=%d %5p [%t] - %m%n
>     |log4j.additivity.R4=false
>     |
>     |log4j.category.org.jboss=WARN
>     |log4j.category.com.printrak=DEBUG
>     |
>     |
>     |--
>     |To unsubscribe, e-mail:   
> <mailto:log4j-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>
-- 
Daniel Serodio <daniel@checkforte.com.br>
CheckForte


--
To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>


Mime
View raw message