1 Reply Latest reply on Sep 2, 2009 4:01 PM by Francisco Jose Peredo Noguez

    Configure log4j; error

    Chris Simons Expert

      Please help me troubleshoot an issue I am having with Seam, log4j, and Weblogic 10.3.1.


      When adding log4j.jar to my application's classpath, Seam is picking up that I want to use log4j and not JDK logging.


      However, I am getting this error message (multiple times) no matter where I place my log4j.properties.



      log4j:ERROR Could not find value for key log4j.appender.stdout
      log4j:ERROR Could not instantiate appender named "stdout".




      According to the Seam Docs:


      Seam logging automagically chooses whether to send output to log4j or JDK logging. If log4j is in the classpath, Seam with use it. If it is not, Seam will use JDK logging.


      I'm pretty sure Seam and Weblogic are picking up log4j (and Weblogic is configured to use log4j); but I believe these errors are preventing anything from being logged.


      Here is my log4j.properties:



      # Log4j configuration file.
      log4j.rootLogger=INFO,A1,stdout
      
      # STDOUT is STDOUT logging
      log4j.appender.stdout=org.apache.log4j.ConsoleAppender
      log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
      log4j.appender.stdout.layout.ConversionPattern=%d %p [%t] %C{1} - %m%n
      
      
      # A1 is a FileAppender
      #
      log4j.appender.A1.Append=true
      log4j.appender.A1.File=englink-log4j.log
      log4j.appender.A1.Threshold=INFO
      log4j.appender.A1=org.apache.log4j.FileAppender
      log4j.appender.A1.layout=org.apache.log4j.PatternLayout
      log4j.appender.A1.layout.ConversionPattern=%-5p [%t] - %m%n
      #
      #set level
      #
      log4j.logger.com=INFO



      Any thoughts, anyone?  Please?? :)



        • 1. Re: Configure log4j; error
          Francisco Jose Peredo Noguez Master

          Have you tried writing it like this (first define the appender and only then setting is for root):


          # STDOUT is STDOUT logging
          log4j.appender.stdout=org.apache.log4j.ConsoleAppender
          log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
          log4j.appender.stdout.layout.ConversionPattern=%d %p [%t] %C{1} - %m%n
          
          # A1 is a FileAppender
          #
          log4j.appender.A1.Append=true
          log4j.appender.A1.File=englink-log4j.log
          log4j.appender.A1.Threshold=INFO
          log4j.appender.A1=org.apache.log4j.FileAppender
          log4j.appender.A1.layout=org.apache.log4j.PatternLayout
          log4j.appender.A1.layout.ConversionPattern=%-5p [%t] - %m%n
          
          # Log4j configuration file.
          log4j.rootLogger=INFO,A1,stdout
          
          #
          #set level
          #
          log4j.logger.com=INFO
          



          Anyway, I recommend you to switch to slf4j integrated with logback, both created by the author of log4j, but much improved (and fully backwards compatible if you need it to be)