Ouch. I have to be careful what I do because this app is moving to standard Java logging under JCL at some point in the future, and I don't want to make that conversion any more difficult than I have to.
I did just discover the LevelRangeFilter, and that seems like it might do what I want... Then I can limit the CONSOLE and APPINFOFILE appenders to debug-info, and limit APPERRORFILE to error-error. I *think* that will do what I want. Like I said, that might cause me a problem down the road when I have to move off Log4J, but I'm still hoping that won't happen (probably a losing battle though), and this seems like a fairly simple answer, assuming it works like I think. Does anyone know what the performance implications of using a filter is? I kind of assume there is a filter that is used all the time anyway and I'm just replacing that, is that right? -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Thu, July 7, 2005 4:22 pm, Ford, Peter said: > > We had a similar problem in one application. What we ended up doing was > creating separate loggers for debug, info and error messages. To make > life easier we then created local debug(), info() and error() methods > that directed the message to the correct logger. Slightly messy but it > did the trick and we didn't have to write custom filters. > > --Pete > >> -----Original Message----- >> From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] >> Sent: Thursday, July 07, 2005 3:05 PM >> To: Log4J Users List >> Cc: Log4J Users List >> Subject: RE: XML config questino >> >> That's correct, that's indeed what happens (I hope I didn't botch the >> explanation before!) >> >> The problem though is that I have about 10 packages to log, hence the >> com.company specification, to cover them all. However, now >> I'm trying to >> exclude certain classes, about 20 it looks like, spread >> across almost all >> 10 packages. >> >> From what I understand (I think!), unless there is a way to exclude >> certain things from a category, I'd have to (a) write a custom filter, >> which might be an option or (b) set up a category that >> includes all the >> classes EXCEPT those I don't want logged... while some I may >> be able to >> catch at the package level, most I won't because they would >> include some >> of those "do not log" classes, so I'm looking at potentially >> hundreds of >> category definitions at the class level... obviously not the >> way to go :) >> >> -- >> Frank W. Zammetti >> Founder and Chief Software Architect >> Omnytex Technologies >> http://www.omnytex.com >> >> On Thu, July 7, 2005 3:55 pm, Ford, Peter said: >> > >> > The way I read this, if you call log.error() then the >> message will be >> > logged to the APPINFOFILE and APPERRORFILE appenders >> because the level >> > of the message ("error") is >= the threshold level on both appenders >> > (one is ERROR, the other is DEBUG). I think. >> > >> > --Pete >> > >> >> -----Original Message----- >> >> From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] >> >> Sent: Thursday, July 07, 2005 2:45 PM >> >> To: log4j-user@logging.apache.org >> >> Subject: XML config questino >> >> >> >> Hi all... I have what I thought would be a simple >> question, but it's >> >> completely beating me... >> >> >> >> I am using the XML config file seen below, Log4J 1.2.8. >> The problem I >> >> have is that anything that calls log.error() in my code goes to >> >> appError.log as I want, but it *ALSO* goes to appInfo.log. I >> >> need it to >> >> *ONLY* go to appError.log. >> >> >> >> Problem is, I haven't been able to figure out how to >> >> configure that. I >> >> thought I could just add another category, but because I have >> >> classes all >> >> throughout the app in various packages, this doesn't seem to >> >> be the right >> >> answer. >> >> >> >> Can anyone point me in the right direction? Thanks! >> >> >> >> <?xml version="1.0" encoding="UTF-8" ?> >> >> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> >> >> <log4j:configuration >> xmlns:log4j="http://jakarta.apache.org/log4j/"> >> >> <appender name="CONSOLE" >> class="org.apache.log4j.ConsoleAppender"> >> >> <param name="Threshold" value="DEBUG"/> >> >> <layout class="org.apache.log4j.PatternLayout"> >> >> <param name="ConversionPattern" value="%d %-5p %l >> %x- %m\n" /> >> >> </layout> >> >> </appender> >> >> <appender name="APPINFOFILE" >> class="org.apache.log4j.FileAppender"> >> >> <param name="Threshold" value="DEBUG"/> >> >> <param name="File" value="appInfo.log"/> >> >> <param name="Append" value="false"/> >> >> <layout class="org.apache.log4j.PatternLayout"> >> >> <param name="ConversionPattern" value="%d %-5p %l >> %x- %m\n" /> >> >> </layout> >> >> </appender> >> >> <appender name="APPERRORFILE" >> class="org.apache.log4j.FileAppender"> >> >> <param name="Threshold" value="ERROR"/> >> >> <param name="File" value="appError.log"/> >> >> <param name="Append" value="false"/> >> >> <layout class="org.apache.log4j.PatternLayout"> >> >> <param name="ConversionPattern" value="%d %-5p %l >> %x- %m\n" /> >> >> </layout> >> >> </appender> >> >> <appender name="APPAGINGFILE" >> class="org.apache.log4j.FileAppender"> >> >> <param name="Threshold" value="DEBUG"/> >> >> <param name="File" value="appAging.log"/> >> >> <param name="Append" value="false"/> >> >> <layout class="org.apache.log4j.PatternLayout"> >> >> <param name="ConversionPattern" value="%d %-5p %l >> %x- %m\n" /> >> >> </layout> >> >> </appender> >> >> <category name="com.company" additivity="true"> >> >> <appender-ref ref="CONSOLE" /> >> >> <appender-ref ref="APPINFOFILE" /> >> >> <appender-ref ref="APPERRORFILE" /> >> >> </category> >> >> <category >> >> name="com.company.app.daemonthreads.AgingProcessDaemonThread" >> >> additivity="true"> >> >> <appender-ref ref="APPAGINGFILE" /> >> >> </category> >> >> </log4j:configuration> >> >> >> >> -- >> >> Frank W. Zammetti >> >> Founder and Chief Software Architect >> >> Omnytex Technologies >> >> http://www.omnytex.com >> >> >> >> >> --------------------------------------------------------------------- >> >> 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] >> > > --------------------------------------------------------------------- > 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]