logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kiran Raja <kr...@humana.com>
Subject RE: Multiple logs
Date Fri, 03 Dec 2004 15:16:38 GMT
David,

The efficiency of what you are trying to do, depends on whether you are 
going to have a finite number of threads in your applicaiton or not and if 
you have a way to perform some processing at the start of every thread.

If you are explicitly creating multiple threads for multiple services in 
the application then you can get under the hood of log4net config when 
each thread starts and can manipulate how logging is done for that 
specific thread. (You can refer to the source or other posts in this list 
that explain how to do this)

But the easiest would be something similar to what Graham suggested, maybe 
using NDC and MDC (you can find the documentation for these two in log4net 
docs). Then you can control what gets logged and can set threadid as well 
as anything else that will make your log unique, ex: userid etc. Then 
coupled with timestamp you can slice and dice the logs according to thread 
and/or user etc. either by reading the logfile using a program or 
importing it into excel etc.

HTH

Regards,
KR





"Graham Allwood" <graham.allwood@eborsolutions.com> 
12/03/2004 06:12 AM
Please respond to
"Log4NET User" <log4net-user@logging.apache.org>


To
"'Log4NET User'" <log4net-user@logging.apache.org>
cc

Subject
RE: Multiple logs






I don?t know if this helps much but do you know that the thread id can be 
included in the log output ? using the patternlayout component anyway. If 
doesn?t give you separate output but I suppose you log to a file you could 
then analyze it further in Excel.
 
 
Regards
 
Graham 
 

From: GROSPELIER David [mailto:dgrospelier@sword-group.com] 
Sent: 03 December 2004 10:59
To: log4net-user@logging.apache.org
Subject: Multiple logs
 
Hi,
 
I want to generate a log file for every thread in my application. My 
application is multithread and I want to know which thread does which 
action.
Today, I?ve only one log file but the log entries are mixed and can?t find 
which thread is concerned?
 
Any help is appreciated!
 
Thanks.
 
David Grospelier
Chef de projets
Sword - www.sword.fr
 
 



The information transmitted is intended only for the person or entity to which it is addressed
and may contain CONFIDENTIAL material.  If you receive this material/information in error,
please contact the sender and delete or destroy the material/information.

Mime
View raw message