help with log4j

Discussions

Web tier: servlets, JSP, Web frameworks: help with log4j

  1. help with log4j (5 messages)

    Hi,
    I wanted to use the log4j with a configuration file so,

    I created an init servlet that configures log4j using "mylog4j.properties" upon startup.
    I put "mylog4j.properties" in myapp/WEB-INF/classes and
    log4j.jar in myapp/WEB-INF/lib.
    but I kept getting the message displayed at the bottom of this post. when I ran out of patience, I deleted tomcat directory and installed a new one. Without any applications in webapps i still got the same stupid message. Help
     
    log4j:WARN No appenders could be found for logger (org.apache.commons.digigester).
    log4j:WARN Please initialize the log4j system properly.
    Starting service Tomcat-Standalone
    Apache Tomcat/4.1.27

    Threaded Messages (5)

  2. help with log4j[ Go to top ]

    The message is coming because your log4j configuration file is referring to an appender which log4j is not able to understand.

    The problem is with the contents of your log4j configuration file. Can you please copy the contents of the configuration file.

    hope this helps
  3. help with log4j[ Go to top ]

    Thanks for the quick reply
    Here's mylog4j.properties

    log4j.rootLogger=debug, R
    log4j.appender.R=org.apache.log4j.ConsoleAppender
    log4j.appender.R.layout=org.apache.log4j.SimpleLayout
    log4j.appender.R1=org.apache.log4j.RollingFileAppender
    log4j.appender.R1.File=MDC.log
    log4j.appender.R1.MaxFileSize=100KB
    log4j.appender.R1.MaxBackupIndex=2
    log4j.appender.R1.layout=org.apache.log4j.PatternLayout
    log4j.appender.R1.layout.ConversionPattern=%p - [%X{RemoteHost}] - %m%n
  4. help with log4j[ Go to top ]

    Is it literally "mylog4j.properties"? If so, that might be your problem. The default is "log4j.properties". If you use another name, you have to pass it in on the Java command line as "log4j.configuration=<filename>".

        -Mike
  5. help with log4j[ Go to top ]

    Hi,

    Thank you guys, I got it to work. Well, I don't know where I read this but I was told to put log4j.jar in JAVA_HOME\ext\lib. As soon as I took it out of there, Everyting started working. thank you for your help
  6. Hi Ahmed:

    I have one log file for all our modules in a project and is working successfully. We added one application to this project and has to run independently. For this I need to create another logger and created one.
    But the problem is after writing the code, All modules and the new application logging information is going only to one log file depends on the configuration. System is not able to differentiate between the modules and new Application. Can you please suggest in this matter...I can call if you want me to.

    Thank You
    Hari