Log4j and Tomcat Question - Java

This is a discussion on Log4j and Tomcat Question - Java ; Hi, I have a web application (using J2EE) which runs on 3 tomcats (4.0) for Load Balancing. I have recently started to use the Log4j in this application. Currently the logs for this application is of the tomcat's(System.out.println...) - and ...

+ Reply to Thread
Results 1 to 2 of 2

Log4j and Tomcat Question

  1. Default Log4j and Tomcat Question

    Hi,
    I have a web application (using J2EE) which runs on 3 tomcats (4.0)
    for Load Balancing.
    I have recently started to use the Log4j in this application.
    Currently the logs for this application is of the
    tomcat's(System.out.println...) - and because there are 3 tomcats
    there are 3 logs.
    The log4j writes to one file only.
    My question is:
    How can I tell in the log4j log from which server the request came
    from?

    Thanks,
    Adi.

  2. Default Re: Log4j and Tomcat Question

    adi@domainthenet.com (Adi) wrote:
    > Hi,
    > I have a web application (using J2EE) which runs on 3 tomcats (4.0)
    > for Load Balancing.
    > I have recently started to use the Log4j in this application.
    > Currently the logs for this application is of the
    > tomcat's(System.out.println...) - and because there are 3 tomcats
    > there are 3 logs.
    > The log4j writes to one file only.
    > My question is:
    > How can I tell in the log4j log from which server the request came
    > from?
    >
    > Thanks,
    > Adi.


    Dude,

    The documentation to Log4J specifies that you should place the
    log4j.properties file in the WEB-INF/classes directory for your web
    application. Every web application deployed under the C:\Tomcat 5.0.19
    \webapps directory should have it's own WEB-INF/classes directory. Hence,
    every application can independently be assigned it's own log file using
    Log4J.

    The "log4j.properties" file also allows you to dynamically target which
    directory you want to put your Error log and Debug log.


    For your Error log, go to the Rolling File Appender section for errors
    and modify the line:

    log4j.appender.roll-error.File=
    C:/Tomcat 5.0.19/webapps/MyPortal/Logs/error.log


    For your Debug log, go to the Rolling File Appender section for debug and
    modify the line:

    log4j.appender.roll-debug.File=
    C:/Tomcat 5.0.19/webapps/MyPortal/Logs/debug.log


    Of course the location and the name of the error and debug log files can
    be any location and file name that you choose. Chances are, your
    log4j.properties files are all pointing to the same location.

    All I know is that I have several web applications under the C:/Tomcat
    5.0.19/webapps directory, and each uses it's own log file depending on
    the naming convention I use with the log4j.appender.roll-debug.File=
    parameter.

    Later

+ Reply to Thread

Similar Threads

  1. tomcat - log4j logfile
    By Application Development in forum Java
    Replies: 5
    Last Post: 11-15-2007, 05:15 AM
  2. Tomcat 6.0.10 with log4j 1.2.14
    By Application Development in forum Java
    Replies: 2
    Last Post: 08-19-2007, 06:32 AM
  3. Re: Tomcat 6.0.10 with log4j 1.2.14
    By Application Development in forum Java
    Replies: 0
    Last Post: 08-15-2007, 07:24 AM
  4. Tomcat 6.0.10 with log4j 1.2.14
    By Application Development in forum Java
    Replies: 0
    Last Post: 08-15-2007, 04:52 AM
  5. tomcat log4j
    By Application Development in forum Java
    Replies: 3
    Last Post: 07-31-2007, 02:58 PM