1 Reply Latest reply: May 20, 2014 3:07 PM by Venkat.Nagi-Oracle RSS

    How to use log4j for  non-Coherence log messages?

    2644841

      I have configured Coherence to use log4j and the Coherence log messages are indeed logged to the file specified in my log4j.properties file. However, any log messages I attempt to log in my own Java classes do not appear in the log files. Can anyone point out what I am missing?

       

      Coherence is configured to use log4j by setting the following config in my tangosol-coherence-override.xml

       

      <logging-config>
               <severity-level system-property="tangosol.coherence.log.level">9</severity-level>
              <destination system-property="tangosol.coherence.log">log4j</destination>
          </logging-config>
      

       

      My log4j.properties file (which is on the class path), is as follows:

       

      log4j.rootLogger=debug, file
      log4j.logger.Coherence=debug
      
      log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
      log4j.appender.file.File=D:\\logs\\coherence\\coherence.log
      log4j.appender.file.layout=org.apache.log4j.PatternLayout
      log4j.appender.file.layout.ConversionPattern=%m%n
      log4j.appender.file.DatePattern='.'yyyy-MM-dd
      log4j.appender.file.threshold=DEBUG
      

       

      I then create a logger in one of my classes like so:

       

      private static Logger logger = Logger.getLogger(EfxResourceConfig.class.getName());
      

       

      and log to it like so:

       

      logger.info("EfxResourceConfig: Initialized");
      

       

      My log message never appears however. I am certain that the code in which the log message resides is executed as the associated functionality works correctly.

       

      Thanks