Hi; Well, I'm off for a fun weekend - thank you to all for helping.
If by any chance any of you are working this weekend... As you said, what I want is: warn from anything to stdout and tomcat info from org.apache to stdout thanks - dave David Thielen 303-499-2544 www.windwardreports.com -----Original Message----- From: Schuweiler, Joel J. [mailto:[EMAIL PROTECTED] Sent: Friday, September 23, 2005 2:27 PM To: 'Log4J Users List' Subject: RE: Duplicate log entries - 1 last issue Except he wants two different levels, he wants one level to go to blah, and another level to go to blah. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of James Stauffer Sent: Friday, September 23, 2005 3:26 PM To: Log4J Users List Subject: Re: Duplicate log entries - 1 last issue On 9/23/05, David Thielen <[EMAIL PROTECTED]> wrote: > Ok, I think I get it now. Is this correct: > > All <root> and <logger> entries cause log entries to be written. > > It does not look for duplicates so having something in there twice cause it > to be written twice to the same appender. > > A <logger> with additivity='true' means do this in addition to root for the > name= classes. > > A <logger> with additivity='false' means do this only for the name= classes > - ignore <root> settings for this class. > > Is that right? Not exactly but I don't have time to explain right now. > That means to get warn in stdout & tomcat, and info for org.apache in stdout > only, I have to do: > > <logger name="org.apache" additivity="false"> > <level value="info"/> > <appender-ref ref="stdout" /> > </logger> > <logger name="org.apache" additivity="false"> > <level value="warn"/> > <appender-ref ref="tomcat" /> > </logger> > <root> > <priority value="warn" /> > <appender-ref ref="stdout" /> > <appender-ref ref="tomcat" /> > </root> > > But... I can't have 2 loggers with the same name. Merge them <logger name="org.apache" additivity="false"> <level value="info"/> <appender-ref ref="stdout" /> <appender-ref ref="tomcat" /> </logger> > > So, how can I do this? > > > Thanks - dave > > > David Thielen > 303-499-2544 > www.windwardreports.com > > -----Original Message----- > From: James Stauffer [mailto:[EMAIL PROTECTED] > Sent: Friday, September 23, 2005 12:23 PM > To: Log4J Users List > Subject: Re: Duplicate log entries - 1 last issue > > <root is basically the same as <logger name="."> or <logger name="">. > It is just the root of the logger tree. > > On 9/23/05, David Thielen <[EMAIL PROTECTED]> wrote: > > Hi; > > > > I think I don't understand <root> and <logger> The way I read the docs > > <root> is what is done to all classes for the appenders listed. The > <logger> > > adds to that. > > > > So I put the following: > > <root> > > <priority value="warn" /> > > <appender-ref ref="stdout" /> > > <appender-ref ref="tomcat" /> > > </root> > > > > Which puts all warn and worse in those 2 appenders. And that works fine. > > > > But then I also want info for org.apache in stdout only. So I add: > > <logger name="org.apache" additivity="false"> > > <level value="info"/> > > <appender-ref ref="stdout" /> > > </logger> > > > > And now tomcat gets nothing written to it. Why? The <logger> element does > > not mention tomcat. > > > > ??? - thanks - dave > > > > > > David Thielen > > 303-499-2544 > > www.windwardreports.com > > > > -----Original Message----- > > From: James Stauffer [mailto:[EMAIL PROTECTED] > > Sent: Friday, September 23, 2005 7:23 AM > > To: Log4J Users List > > Subject: Re: Duplicate log entries - 1 last issue > > > > On 9/22/05, David Thielen <[EMAIL PROTECTED]> wrote: > > > If I have: > > > <logger name=3D"org.apache" additivity=3D"false"> > > > <level value=3D"info"/> > > > <appender-ref ref=3D"stdout" /> > > > </logger> > > > Then nothing is written to the tomcat appender. > > > > Changing that to the following would also send the output to tomcat > > <logger name="org.apache" additivity="false"> > > <level value="info"/> > > <appender-ref ref="stdout" /> > > <appender-ref ref="tomcat" /> > > </logger> > > > > > If I have: > > > > > > <logger name=3D"org.apache"> > > > <level value=3D"info"/> > > > <appender-ref ref=3D"stdout" /> > > > </logger> > > > > > > Then I get two problems: > > > > > > First, tomcat now has INFO logging (want that in stdout only). Second, > > > stdout gets each entry twice. > > To fix the first problem you could set a threshold on the tomcat > > appender so it only write warn logs. > > <param name="Threshold" value="warn"/> > > > > To solve the 2nd problem you you need to make sure that either > > additivity is false for <logger name="org.apache"> or that tomcat > > isn't specified for both <logger name="org.apache"> and <root>. > > > > > > > > > > Log4j.xml: > > > > > > <?xml version=3D"1.0" encoding=3D"UTF-8" ?> <!DOCTYPE > log4j:configuration > > > SYSTEM "log4j.dtd"> <log4j:configuration > > > xmlns:log4j=3D"http://jakarta.apache.org/log4j/"> > > > > > > > > > > > > <appender name=3D"stdout" > > > > > > class=3D"org.apache.log4j.ConsoleAppender"> > > > > > > <layout class=3D"org.apache.log4j.PatternLayout"> > > > > > > <param name=3D"ConversionPattern" value=3D"%5p [%t] %m > - > > > %c %M%n"/> > > > > > > </layout> > > > > > > </appender> > > > > > > > > > > > > <appender name=3D"tomcat" > > > > > > class=3D"org.apache.log4j.RollingFileAppender"> > > > > > > <param name=3D"file" > > > > > > value=3D"${catalina.home}/logs/tomcat.log"/> > > > > > > <param name=3D"MaxFileSize" value=3D"100KB"/> > > > > > > <param name=3D"MaxBackupIndex" value=3D"10"/> > > > > > > <layout class=3D"org.apache.log4j.PatternLayout"> > > > > > > <param name=3D"ConversionPattern" > > > > > > value=3D"%d{HH:mm:ss.SSS} %5p [%t] %c - %m%n"/> > > > > > > </layout> > > > > > > </appender> > > > > > > > > > > > > <appender name=3D"windward" > > > > > > class=3D"org.apache.log4j.RollingFileAppender"> > > > > > > <param name=3D"file" > > > > > > value=3D"${catalina.home}/logs/windward.log"/> > > > > > > <param name=3D"MaxFileSize" value=3D"100KB"/> > > > > > > <param name=3D"MaxBackupIndex" value=3D"10"/> > > > > > > <layout class=3D"org.apache.log4j.PatternLayout"> > > > > > > <param name=3D"ConversionPattern" > > > > > > value=3D"%d{HH:mm:ss.SSS} %5p [%t] %c - %m%n"/> > > > > > > </layout> > > > > > > </appender> > > > > > > > > > > > > <logger name=3D"net.windward" additivity=3D"false"> > > > > > > <level value=3D"info"/> > > > > > > <appender-ref ref=3D"windward" /> > > > > > > </logger> > > > > > > <logger name=3D"org.apache"> > > > > > > <level value=3D"info"/> > > > > > > <appender-ref ref=3D"stdout" /> > > > > > > </logger> > > > > > > <root> > > > > > > <priority value=3D"warn" /> > > > > > > <appender-ref ref=3D"stdout" /> > > > > > > <appender-ref ref=3D"tomcat" /> > > > > > > </root> > > > > > > > > > > > > </log4j:configuration> > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > James Stauffer > > Are you good? Take the test at http://www.livingwaters.com/good/ > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > -- > James Stauffer > Are you good? Take the test at http://www.livingwaters.com/good/ > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- James Stauffer Are you good? Take the test at http://www.livingwaters.com/good/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
