Nevermind, I found the answer just as soon as I posed my question to the entire world. 
 :-)

FYI, for you folks who have similar issues, change:

  log4j.logger.SomeNamedCategoryThatIsSortOfChattyAtDebug=INFO

to:

  log4j.loggerFactory=com.yourcompany.YourLogger
  log4j.logger.SomeNamedCategoryThatIsSortOfChattyAtDebug=INFO

in my example property file.

cheers,
Steve



-----Original Message-----
From: Gingras, Stephen 
Sent: Friday, February 21, 2003 6:40 PM
To: [EMAIL PROTECTED]
Subject: Properties file advise needed


Does anyone know how I can specify the specific subclass for a Logger class for a 
named logger in a log4j property file (vice xml-based file)?  I extended Logger and am 
now receiving the dreaded ClassCastException when I explicitly set the level of a 
named logger.  I know why I am getting the exception and have also heard the arguments 
for wrapping instead of extending, but am stuck for reasons beyond the scope of this 
message.  I have seen examples of how to specify the logger class in an xml-based 
log4j config file, but need advise for property files.  We have quite a few of them. :)
 
In general, we have property files that look like:
 
 
log4j.rootCategory=DEBUG, console, file
 
log4j.logger.SomeNamedCategoryThatIsSortOfChattyAtDebug=INFO
 
# console appender settings
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.Threshold=INFO
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d|%p|%c|%m%n
 
# file appender settings
log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
log4j.appender.file.Threshold=DEBUG
log4j.appender.file.File=filename.log
log4j.appender.file.Append=true
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d|%p|%c|%m%n
log4j.appender.file.DatePattern='.'yyyy-MM-dd
 
 
In the example above, the Logger named "SomeNamedCategoryThatIsSortOfChattyAtDebug" is 
not of type Logger, but is of a subtype of Logger.  I need to let log4j know the 
subtype before it instantiates one first as type Logger to avoid the 
ClassCastException when I try to cast it to my custom Logger type later on.
 
Thanks in advance for any advice that you may be able to offer.
 
cheers,
Steve

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to