Glen, I am not sure, If I really understand your question, but you "could" write your own Custom Filter.
So, in your application, you want to set the root threshold to FATAL and then for certain packages lower the level to DEBUG or INFO. But for this one package, I want to see the info and traces logged etc, but not to log the ERROR or FATAL. Here is the hierarchy as per log4jm which does not seem to include trace. ALL < DEBUG < INFO < WARN < ERROR < FATAL < OFF. Custom filters are based on ternary logic. The decide(LoggingEvent) method of each filter is called in sequence. This method returns one of the integer constants DENY, NEUTRAL or ACCEPT. If the returned value is DENY, then the log event is dropped immediately without consulting the remaining filters. If the value returned is NEUTRAL, then the next filter in the chain is consulted. If there are no further filters to consult, then the logging event is processed normally. If the returned value is ACCEPT, then the logging event is processed immediately skipping the remaining filters. Here is a sample: <filter class="org.apache.log4j.varia.StringMatchFilter"> <param name="StringToMatch" value="hot cakes" /> <param name="AcceptOnMatch" value="false" /> </filter> <filter class="org.apache.log4j.varia.StringMatchFilter"> <param name="StringToMatch" value="CPU cycles" /> <param name="AcceptOnMatch" value="false" /> </filter> Also: <filter class="org.apache.log4j.varia.StringMatchFilter"> <param name="StringToMatch" value="teacher" /> <param name="AcceptOnMatch" value="true" /> </filter> <filter class="org.apache.log4j.varia.LevelMatchFilter"> <param name="LevelToMatch" value="info" /> <param name="AcceptOnMatch" value="true" /> </filter> Contrary to the previous filter chain, instead of denying events on match, this chain accepts events when a match occurs. Hope this helps. -Kamal. -----Original Message----- From: Drinkwater, GJ (Glen) [mailto:[EMAIL PROTECTED] Sent: Thursday, February 15, 2007 11:00 AM To: Log4J Users List Subject: RE: Log4j xml configuration Hi Thanks for the help. Also, is it possible to level filter a package like you can do with a appender. What I have done is to set the root threshold to FATAL and then for certain packages lower the level to DEBUG or INFO. But for this one package, I want to see the info and traces logged etc, but not to log the ERROR or FATAL. Is this possible? glen -----Original Message----- From: Kamal Ahmed [mailto:[EMAIL PROTECTED] Sent: 15 February 2007 15:40 To: Log4J Users List Subject: RE: Log4j xml configuration Glen, Here is a sample which will help you understand how you can use xml config file, basically you use the format: <level value="info" /> In the logger section: Here are the file contents: <?xml version="1.0" encoding="UTF-8" ?> <webm_journal_logging> <appender name="StdErr" class="org.apache.log4j.ConsoleAppender"> <param name="target" value="System.Err" /> <layout class="com.webmethods.sc.logging.log4j.DefaultG8dEventLayout" /> </appender> <!-- This appender will send log messages with a level of 'warn' and above to './log/server.log'; with daily rollover to, e.g. './log/server.log.2006-07-17'. --> <appender name="DailyFile" class="com.webmethods.sc.logging.log4j.WmDailyFileAppender"> <param name="file" value="log/server.log" /> <param name="datePattern" value=".yyyy-MM-dd" /> <param name="threshold" value="debug" /> <layout class="com.webmethods.sc.logging.log4j.DefaultG8dEventLayout" /> </appender> <logger name="webm.sc.sample.sub1" additivity="true"> <level value="info" /> <appender-ref ref="StdErr" /> <appender-ref ref="DailyFile" /> </logger> <root> <level value="debug" /> <appender-ref ref="DailyFile" /> <appender-ref ref="StdErr" /> </root> <threshold> <level value="debug" /> </threshold> </webm_journal_logging> -Kamal. -----Original Message----- From: Drinkwater, GJ (Glen) [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 14, 2007 8:20 AM To: log4j-user@logging.apache.org Subject: Log4j xml configuration Hi I am currently moving all our log4j.properties files to XML files and was wondering how I replicate this with the xml configuration. In the properties file, I can put in log4j.logger.my.package=DEBUG Which means only logs from 'my.package' with level DEBUG or above gets logged and anything outside these package does not. How do I do this with an XML configuration. Thanks Glen --------------------------------------------------------------------- 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]