2 Replies Latest reply: Jul 31, 2007 4:58 AM by 807605 RSS

    The problem regarding log4j

    807605
      I would like to seperate the log4j file into two log files, one is for saving DEBUG message, another is for saving ERROR message, but the problem is while error message occurs, both the log will show the message. how can I force the error log only display in the error log file?

      This is my log4j properties file:
       
      log4j.rootCategory=DEBUG,auidtlog, errorlog
      log4j.appender.auidtlog=org.apache.log4j.RollingFileAppender
      log4j.appender.auidtlog.threshold=DEBUG
      log4j.appender.auidtlog.layout=org.apache.log4j.PatternLayout
      log4j.appender.auidtlog.MaxFileSize=1500KB
      log4j.appender.auidtlog.MaxBackupIndex=10
      log4j.appender.auidtlog.layout=org.apache.log4j.PatternLayout
      log4j.appender.auidtlog.layout.ConversionPattern=%d{DATE} [%-5p] [%c] (%F:%L) - %m%n
      log4j.appender.auidtlog.File=C:/Eclipse/workspace/WorkflowActiveReports/WebContent/log/ActiveReport_Audit.log
      
      log4j.appender.errorlog=org.apache.log4j.RollingFileAppender
      log4j.appender.errorlog.threshold=ERROR
      log4j.appender.errorlog.layout=org.apache.log4j.PatternLayout
      log4j.appender.errorlog.MaxFileSize=1500KB
      log4j.appender.errorlog.MaxBackupIndex=10
      log4j.appender.errorlog.layout.ConversionPattern=%d{DATE} [%-5p] [%c] (%F:%L) - %m%n
      log4j.appender.errorlog.File=C:/Eclipse/workspace/WorkflowActiveReports/WebContent/log/ActiveReport_Err.log
      Message was edited by:
      henry_22
        • 1. Re: The problem regarding log4j
          807605
          when you set the threshold level as DEBUG, all the log messages with level DEBUG and above are written on to the appender. Similarly, if the leve is set to INFO, all messages with level equal to INFO and above are appended, but not the DEBUG messages. Set the levels accordingly.
          I think, here, the properties file that you are using should do the job for you.
          • 2. Re: The problem regarding log4j
            807605
            the prolem is I don't want to show all the message above DEBUG, i would like to only show DEBUG message, how can I do that?