facebook

log4j: No appenders…(org.apache.catalina.startup.Embedded)

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #256167 Reply

    tamaluna
    Member

    I used to have log4j working in a Web/Static Web Project, but then I switched over to a MyEclipse/J2EE Projects/Web Project, cos I was tired of the IDE not recognizing JSTL.

    System:
    WinXP Pro
    MyEclipse 4.1.1
    Tomcat 5.0
    j2sdk1.4.2_11

    Now when I start my server (in the IDE), I get the well-known

    log4j:WARN No appenders could be found for logger (org.apache.catalina.startup.Embedded).
    log4j:WARN Please initialize the log4j system properly.

    which I had gotten rid of before by adding a log4j.properties file to the src dir of my project, the contents of which are

    log4j.rootCategory=CONSOLE1, ROLLING1

    # CONSOLE1
    log4j.appender.CONSOLE1=org.apache.log4j.ConsoleAppender

    # CONSOLE1 uses TTCC (Time, Thread Category, Context) Layout, because it’s nice and we’re lazy.
    # Levels used to be called Categories in older versions of log4j.
    log4j.appender.CONSOLE1.layout=org.apache.log4j.TTCCLayout

    # A Rolling Log File
    log4j.appender.ROLLING1=org.apache.log4j.RollingFileAppender
    log4j.appender.ROLLING1.File=test.log
    #log4j.appender.ROLLING1.MaxFileSize=3KB # Just for demo purposes. Use bigger number IRL
    log4j.appender.ROLLING1.MaxBackupIndex=3
    log4j.appender.ROLLING1.layout=org.apache.log4j.TTCCLayout

    What happens now is that the content is output to console, but not to the file (test.log, in this case).

    What am I doing wrong?

    TIA
    ~PT

    #256246 Reply

    Riyad Kalla
    Member

    MyEclipse attaches to the Tomcat process and redirects the output to the Eclipse console. You also have the ROLLING log file setup as well, but it’s likely ending up in a different location than you expect like the execution dir of Eclipse or Tomcat instead of on your web project.

    #256267 Reply

    tamaluna
    Member

    Thanks for the response.

    I was able to find the log file under Tomcat (C:\Tomcat\Tomcat_5_0\bin). (I was sure I had Searched everywhere — can’t explain that.)

    I guess the only troubling thing is the warning that I’m still getting. When I was using the vanilla Eclipse web project, I was able to eliminate the error by adding the log4j.properties file to the src dir. Under the MyEclipse web project, the warning doesn’t seem to go away. Is that normal? Should I just chalk it up to c’est la vie and move on?

    TIA
    ~PT

    #256328 Reply

    Riyad Kalla
    Member

    If your log file is seeing output, then the message itself might just be from Tomcat and not your project.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: log4j: No appenders…(org.apache.catalina.startup.Embedded)

You must be logged in to post in the forum log in