Ravi,
my configuration file is attached as "log4j.properties".
Looking at your code ThubLogger extends Logger and your
printInfo is logging at some level (warning, error ,etc) that is
defined in Logger that ThubLogger is using. I'm wondering that has something to
do
with it? Also attached is an entire java file that uses NDC attached as
"editServlet.java".
Best,
Norma
-----Original Message-----
From: Ravishankar, Narayanan Nair [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 23, 2004 8:08 AM
To: Log4J Users List
Subject: RE: Help on MDC/NDC
Can one help me please with a sample config file ? Eventhough I have
used %x in the pattern, I am not getting desired output. Qall logs are
again messed up, pls help.
Thanks and regards,
Ravi
-----Original Message-----
From: Ravishankar, Narayanan Nair
Sent: Thursday, December 23, 2004 11:21 AM
To: Log4J Users List
Subject: RE: Help on MDC/NDC
Hi,
Can you please send me the config file.
Because when I added as you had mentioned with NDC.push and NDC.pop, I
am not seeing any difference in the output generated.Instaed I see those
meassages which I had put within NDC.push and NDC.pop are coming as
usual, thanks
Regards,
Ravi
-----Original Message-----
From: Norma Spence [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 22, 2004 10:39 PM
To: Log4J Users List
Subject: RE: Help on MDC/NDC
Hi,
I use LogJ4 in my web application. I log Exceptions in my catch
block. Of course you can log anything. my catch block looks like..
catch(Exception e){
NDC.push(the_ID+" "+host+" "+ip+" "+(new
java.util.Date()));
logger.error("from sort function:"+e);
NDC.pop();
}
which is all you have to do each time you want to log something,
push, then pop. I'm using an dailyrollingappender with an html layout
configured by a log4j properties file, which is in my classpath and my
webapps\root\web-inf\classes folder(using tomcat). I like to know alot
about about where the error comes from, not just what the error is the
variables the_ID, host and ip are :
host = request.getRemoteHost();//host name of
client
ip = request.getRemoteAddr();//ip address of
client
the_ID = username;//username of client, my web
application has users
With this method all users have their own neatly seperated line.
attached is my log4j properties file and my latest log file.
Hope this helps,
Norma
-----Original Message-----
From: Ravishankar, Narayanan Nair [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 22, 2004 5:57 AM
To: Log4J Users List
Subject: Help on MDC/NDC
HI all,
I have a servlet as snippet is attached herewith. As you see we are
using a wrapper of Log4j called THubLogger for logging purposes. My
problem is that when I deploy this application in J2EE , when many
concurrent requests are coming in, all log messages of all requests are
getting mixed up and we cannot(very difficult) to identify which request
correspond to which log message. When I posted some weeks before ,
someone suggested MDC and NDC, but I am not clear on how to use it. They
also mentioned about chainsaw utilitu which can separate MDC messages.
Can anyone kindly help on how I should convert the code below, just by
giving one or two lines. And then how to use chainsaw. Please help,
thanks in advance.
public class TimerServlet extends HttpServlet {
TimerUtil aTimerUtil = null;
TaskManager aTaskManager = null;
ThbPropertyReader aThbPropertyReader = new
ThbPropertyReader();
public void init(){
ThubLogger tlog = new ThubLogger();
tlog.printInfo("TimerServlet | init | Started the
TimerServlet");
try {
super.init();
tlog.printInfo("TimerServlet | init | Before
calling Timer Util");
//Reading out the properties through the
ThbPropertyReader
aThbPropertyReader.readPropertiesFile();
String className =
aThbPropertyReader.getTaskManagerClassName();
int initialdelay =
aThbPropertyReader.getInitialTimeDelay();
int scheduledinterval =
aThbPropertyReader.getThbTaskInterval();
//Printing all the properties that was already
read
tlog.printInfo("TimerServlet | The Class Name
| "+className);
tlog.printInfo("TimerServlet | The Initial Delay
| "+initialdelay);
tlog.printInfo("TimerServlet | The scheduled
Interval | "+scheduledinterval);
Regards,
Ravi
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]