Configuring log4j 1.2.8 with tomcat 4.1.30

Discussion in 'Java' started by Rodolfo, Jul 13, 2004.

  1. Rodolfo

    Rodolfo Guest

    Hi,

    I need to configure log4j 1.2.8 with tomcat 4.1.30, I put my
    log4j.properties in "classes" directory but I obtain an error :

    log4j:WARN No appenders could be found for logger
    (org.apache.commons.digester.Digester).
    log4j:WARN Please initialize the log4j system properly.

    I think log4j.properties is correct because I have adapted it from an
    example, my doubt is about that is the place of the log4j.jar. I have
    put it in myapp/web-inf/lib and commons/lib. Is this place correct? Do
    I need to configure a system variable?

    thanks in advance

    Rodolfo
    Rodolfo, Jul 13, 2004
    #1
    1. Advertising

  2. Rodolfo wrote:
    > Hi,
    >
    > I need to configure log4j 1.2.8 with tomcat 4.1.30, I put my
    > log4j.properties in "classes" directory but I obtain an error :
    >
    > log4j:WARN No appenders could be found for logger
    > (org.apache.commons.digester.Digester).
    > log4j:WARN Please initialize the log4j system properly.
    >
    > I think log4j.properties is correct because I have adapted it from an
    > example, my doubt is about that is the place of the log4j.jar. I have
    > put it in myapp/web-inf/lib and commons/lib. Is this place correct? Do
    > I need to configure a system variable?
    >
    > thanks in advance
    >
    > Rodolfo


    Hi,

    your log4j.jar seems to be in the right place, since you are getting
    log4j output. myapp/WEB-INF/lib is the right place for all webapp
    specific libs anyway (shouldn't you also put your commons jar files there??)

    I can't say more without knowing what your code looks like where log4j
    is being initialized. Do you use the PropertyConfigurator? If you do,
    how do you load the log4j.properties file?

    Regards,
    Stefan
    Stefan Waldmann, Jul 13, 2004
    #2
    1. Advertising

  3. Rodolfo

    Rodolfo Guest

    Stefan Waldmann <> wrote in message news:<>...

    > Hi,
    >
    > your log4j.jar seems to be in the right place, since you are getting
    > log4j output. myapp/WEB-INF/lib is the right place for all webapp
    > specific libs anyway (shouldn't you also put your commons jar files there??)
    >
    > I can't say more without knowing what your code looks like where log4j
    > is being initialized. Do you use the PropertyConfigurator? If you do,
    > how do you load the log4j.properties file?
    >
    > Regards,
    > Stefan


    Hi,

    I don't use PropertyConfigurator, only log4j.properties in the place I
    had said. the sentences in the code are :

    import org.apache.log4j.Logger;
    ....
    static Logger log = Logger.getLogger(SolicitudVisita.class);
    ....
    log.debug(" Enviando a página de bien");

    And the content of log4j.properties is :

    log4j.appender.A1=org.apache.log4j.FileAppender
    log4j.appender.A1.File=d:/Tomcat41/webapps/vicy/log/vicy.log

    # Control the maximum log file size
    log4j.appender.A1.MaxFileSize=10000KB
    # Archive log files (one backup file here)
    log4j.appender.A1.MaxBackupIndex=1

    log4j.appender.A1.layout=org.apache.log4j.PatternLayout
    #log4j.appender.A1.layout.ConversionPattern=%p %t %c - %m%n
    log4j.appender.A1.layout.ConversionPattern=%p %c - %m%n

    log4j.logger.es.cyii=debug, A1
    log4j.additivity.es.cyii=false

    If you could say me something why this doesn't work I would appreciate

    Thanks in advance

    Rodolfo
    Rodolfo, Jul 14, 2004
    #3
  4. Rodolfo

    Juha Laiho Guest

    (Rodolfo) said:
    >I need to configure log4j 1.2.8 with tomcat 4.1.30, I put my
    >log4j.properties in "classes" directory but I obtain an error :
    >
    >log4j:WARN No appenders could be found for logger
    >(org.apache.commons.digester.Digester).
    >log4j:WARN Please initialize the log4j system properly.
    >
    >I think log4j.properties is correct because I have adapted it from an
    >example, my doubt is about that is the place of the log4j.jar. I have
    >put it in myapp/web-inf/lib and commons/lib. Is this place correct? Do
    >I need to configure a system variable?


    Unless you want to mess up with internal logging of Tomcat, avoid using
    common/lib -- jars placed there are also visible to the Tomcat server
    code (and as Tomcat uses the jakarta commons logging API, it'll use
    log4j if it's accessible).

    If you plan on running more than one webapp on this server instance,
    I recommend placing the log4j and other jars common to all webapps
    into shared/lib. Depending on your set-up, note that shared/lib is
    rooted in CATALINA_BASE directory, whereas common/lib is rooted in
    CATALINA_HOME. By default these are the same (where Tomcat is installed),
    but the former can be set to point to a different location, to make
    it easier to separate Tomcat distribution from the actual webapps.

    If you want to force use of a log4j.properties file from somewhere
    outside your webapp, you can add the following java system property
    definition to your Tomcat startup:
    -Dlog4j.configuration=file:/path/to/log4j.properties
    --
    Wolf a.k.a. Juha Laiho Espoo, Finland
    (GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
    PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
    "...cancel my subscription to the resurrection!" (Jim Morrison)
    Juha Laiho, Jul 15, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alexandra Stehman

    eclipse, junit, log4j, & finding log4j.xml

    Alexandra Stehman, Jan 19, 2004, in forum: Java
    Replies:
    0
    Views:
    5,751
    Alexandra Stehman
    Jan 19, 2004
  2. Alex Hunsley
    Replies:
    2
    Views:
    12,909
    =?ISO-8859-15?Q?Fr=E9d=E9ric_G=E9din?=
    May 28, 2004
  3. Rodolfo
    Replies:
    0
    Views:
    946
    Rodolfo
    Jul 12, 2004
  4. Manish Hatwalne

    Configuring log4j

    Manish Hatwalne, Nov 23, 2004, in forum: Java
    Replies:
    0
    Views:
    357
    Manish Hatwalne
    Nov 23, 2004
  5. kitty
    Replies:
    0
    Views:
    706
    kitty
    May 6, 2007
Loading...

Share This Page