470,867 Members | 1,805 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,867 developers. It's quick & easy.

Log4j and Tomcat Question

Adi
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.
Jul 17 '05 #1
1 5818
ad*@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
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Aaron Boxer | last post: by
1 post views Thread by Ragavendra BC | last post: by
rsrinivasan
4 posts views Thread by rsrinivasan | last post: by
1 post views Thread by Kedar Kachare | last post: by
reply views Thread by Mikhail Teterin | last post: by
reply views Thread by msg2ajay | last post: by
5 posts views Thread by Abhinay | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.