473,386 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 5952
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Aaron Boxer | last post by:
Hello, My application is using a jar file MyJar.jar that uses log4j (I have the latest release of log4j). I have put both MyJar.jar and log4j.jar in a directory in my classpath. I have also...
1
by: Ragavendra BC | last post by:
Log4j Issue ----------- Hi, I am facing a problem related to Log4j... The problem is such that I have two different Log4j files one in ..properties format and the other in the .xml format.....
2
by: abhilash12 | last post by:
hai how can configure log4j in tomcat pls help me
4
rsrinivasan
by: rsrinivasan | last post by:
Hi, I am using log4j to create log message. I want to write the log message to database. So i configured the log4j.properties files like this... # Database Configuration...
2
by: Hari2349 | last post by:
Regarding to log4j in java program..Plz help me... -------------------------------------------------------------------------------- Hai, friends i used the log4j.properties file like as...
1
by: Kedar Kachare | last post by:
How to use Log4j to create log files using file appender in a Servlet? Also, how to make that Servlet read the log4j.properties file? I have tried following: My web.xml( I use Eclipse europa)...
0
by: Mikhail Teterin | last post by:
Hello! I'm trying to use log4j's SMTPAppender to get warnings and errors reported by our application via e-mail (in addition to having ALL messages saved into a file via RollingFileAppender). ...
0
by: msg2ajay | last post by:
hello, I have configured %CATALINA_HOME% in Win Environ.But as I configured to "${catalina.home}/MQLog/info/info.log" for "file" in log4j.xml I can't see the log file after running my...
5
by: Abhinay | last post by:
Hi there, I am working on server which used thread pool to process each client request by separate dedicated thread. My intention was each thread ( of thread pool ) have its own logger and hence...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.