Configuring class level logging not working.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Michael_Schaefer
Posted On:   Wednesday, June 11, 2003 02:52 PM

I have the following settings in my log4j.properties file: log4j.rootLogger=DEBUG, stdout, normal log4j.logger.SomeUniqueString=DEBUG, requestLog # Setup stdout appender log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d{dd/MM/yy HH:mm} [%-5p] %c{1} - %m%n # Setup Normal Appender log4j.appender.normal=org.apache.log4j.RollingFileAppender log4j.appender.normal.File=normal.log # Setup requestLog Appender log4j.appender.requestLo   More>>

I have the following settings in my log4j.properties file:




log4j.rootLogger=DEBUG, stdout, normal

log4j.logger.SomeUniqueString=DEBUG, requestLog



# Setup stdout appender

log4j.appender.stdout=org.apache.log4j.ConsoleAppender

log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

log4j.appender.stdout.layout.ConversionPattern=%d{dd/MM/yy HH:mm} [%-5p] %c{1} - %m%n



# Setup Normal Appender

log4j.appender.normal=org.apache.log4j.RollingFileAppender

log4j.appender.normal.File=normal.log



# Setup requestLog Appender

log4j.appender.requestLog=org.apache.log4j.RollingFileAppender

log4j.appender.requestLog.File=requests.log




When I try and access the logger and log a test message with the following code the message never appears:




Logger.getLogger("SomeUniqueString").info("This is a test.");




My expectation, given the reading I've done, is that the line of code above would give me access to a logger using the "requestLog" appender. Invoking that should put an [INFO] entry into the "requests.log" logfile. However, the logfile is always a zero byte file. All the other logging in the application outputs to "normal.log" just fine. I need to be able to log requests to our system in a separate logfile with a separate format. Can someone please give me a nudge in the right direction on how to solve this problem?



Thanks,



Michael

   <<Less

Re: Configuring class level logging not working.

Posted By:   Vishal_T  
Posted On:   Thursday, June 26, 2003 11:29 AM

I'm pretty new to this but it sems that requestLog is not
defined as a logger in your properties file. In the first line
of code you have only defined stdout and normal as your
loggers. requestLog is missing.


Vishal
About | Sitemap | Contact