473,811 Members | 3,521 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5989
ad*@domainthene t.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.propertie s 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.properti es" 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.propertie s 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
180329
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 put the file "log4j.properties" into this same directory. My log4j.properties file reads:
1
5607
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.. and their source code is like this
2
1670
by: abhilash12 | last post by:
hai how can configure log4j in tomcat pls help me
4
7426
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 log4j.appender.dbase =org.apache.log4j.jdbc.JDBCAppender log4j.appender.dbase.layout =org.apache.log4j.PatternLayout log4j.appender.dbase.driver =com.microsoft.sqlserver.jdbc.SQLServerDriver log4j.appender.dbase.URL ...
2
2008
by: Hari2349 | last post by:
Regarding to log4j in java program..Plz help me... -------------------------------------------------------------------------------- Hai, friends i used the log4j.properties file like as below...... log4j.rootLogger=VERBOSE, stdout log4j.appender.stdout=org.apache.log4j.ConsoleAppe nder
1
5524
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) <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"...
0
5724
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). It all works, except for one thing -- every warning/error arrives in its own e-mail message... The BufferSize parameters appears intended to regulate this, but no matter
0
1403
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 application. i have place INFO in my code, I can see INFO log in Tomcat console, my log4j.xml file is as below. --------------------------- <?xml version="1.0" encoding="UTF-8"?>
5
4116
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 all client processed by that thread must be logged in corresponding thread specific logger. My problem is that logger merging log content with other logger content, my doubt is Logger.getLogger(...) function return wrong logger object. I am...
0
10647
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10384
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10130
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9204
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7667
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5553
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4338
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3865
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.