Janusz,

If your subsystems are running in separate threads, I have a set of classes
that wraps log4j and automatically creates a new logger (Category) for each
thread, and each thread can then be configured (via XML/JDOM or via specific
SetXxxx()-style calls) independently.  

It has the concept of a hierarchy so that defaults can be set up, then as
threads are created their loggers are created with those defaults, which can
be overridden on a per-thread basis.  This way each thread can have its own
log level, its own output format, its own output file, or whatever you want.


I also have something that lets you define "log types" so that you can not
only turn on logging for "levels" (which only result in increasing or
decreasing amounts of general logging), but you can easily define and
enable/disable types so that, for instance, you could set up HTTP logging to
selectively log HTTP requests and results so that you can easily diagnose
HTTP problems, or Socket logging so that you can trace/debug your socket
logic, or XYZ logging so that you can troubleshoot that tricky new XYZ
algorithm, or whatever you want.  It seems to work pretty well.  

If you think it'll help you, let me know and I'll see if I can get Legal to
release it to the public domain.

Bill Rebey 

-----Original Message-----
From: Mark Womack [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 26, 2002 12:37 PM
To: 'Log4J Users List'
Subject: RE: partitioning log4j into sub-systems


Do your subsystems run in their own thread?  If so, one option might be to
set the NDC (nested diagnostic context) value to the sub-system value and
then filter the messages to different appenders based on the NDC value.  The
categories would still use their same logging names, but the NDC would track
the subsystem in which they are being used.  With the release of v1.2 you
might want to take a look at using MDC insated of NDC.

-Mark

-----Original Message-----
From: Janusz Dalecki [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 7:21 PM
To: [EMAIL PROTECTED]
Subject: partitioning log4j into sub-systems


We have a very big system, with plenty of classes and sub-projects. I
would like to configure log4j in such a way that categories are not
particular classes (as it is now) but sub-systems (one class can belong
to a few sub-systems) - is there any other way of doing that then
introducing a property for every single class - let's say loggerName
that would then be set at run-time to the sub-system's logger name to
log messages in that category?.

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>





======================= Confidentiality Statement ======================= 
The information contained in this message and any attachments is 
intended only for the use of the individual or entity to which it is 
addressed, and may contain information that is PRIVILEGED, CONFIDENTIAL 
and exempt from disclosure under applicable law.  If you have received 
this message in error, you are prohibited from copying, distributing, or 
using the information.  Please contact the sender immediately by return 
e-mail and delete the original message from your system. 
===================== End Confidentiality Statement =====================  



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to