Janusz, v1.2 of log4j is currently beta 4 and the beta 5 (or rc) release is pending for the near future. The MDC will be available starting with v1.2. So, you can start playing with NDC if you like.
Do you want: 1) The subsystem name to be printed as part of the logging message? 2) Do you want to shunt messages from a sub-system to it's own appender? To do #1, then you just need to add "%x" to your PatternLayout setting. The "%x" conversion specifier is for NDC and it prints out the NDC value as part of the message. Interestingly, I don't see a conversion specifier for MDC mentioned in the PatternLayout javadoc (Ceki?). You might need to look at the code to see what it is, or maybe I just missed it. To do #2, you will need to write your own custom Filter class and attach it to the appender in your config file. Writing a custom Filter is extremely easy, and it has access to the NDC and MDC information, making it easy to decide if a message should be sent to the appender or not. See the javadoc on Filter for more details. -Mark -----Original Message----- From: Janusz Dalecki [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 26, 2002 3:18 PM To: Log4J Users List Subject: RE: partitioning log4j into sub-systems Mark, Do I need to specify a special flag in layout for MDC to work? BTW - I have found only Beta version of 1.2 Regards Janusz -----Original Message----- From: Mark Womack [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 27, 2002 4:37 AM 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]> -- 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]>