

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
13 messages in org.apache.logging.log4j-userRe: Log4j category for a thread| From | Sent On | Attachments |
|---|---|---|
| Tony Thompson | Jun 7, 2004 8:30 pm | |
| Paul Smith | Jun 7, 2004 8:43 pm | |
| Tony Thompson | Jun 8, 2004 6:11 am | |
| Ceki Gülcü | Jun 8, 2004 7:20 am | |
| Tony Thompson | Jun 8, 2004 8:00 am | |
| Ceki Gülcü | Jun 8, 2004 8:36 am | |
| Tony Thompson | Jun 8, 2004 9:06 am | |
| Paul Smith | Jun 8, 2004 3:21 pm | |
| Larry Young | Jun 8, 2004 4:09 pm | |
| Tony Thompson | Jun 8, 2004 5:31 pm | |
| Paul Smith | Jun 8, 2004 5:57 pm | |
| Sullivan, Sean C - MWT | Jun 8, 2004 6:04 pm | |
| Tony Thompson | Jun 8, 2004 8:07 pm |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: Log4j category for a thread | Actions... |
|---|---|---|
| From: | Ceki Gülcü (ce...@qos.ch) | |
| Date: | Jun 8, 2004 7:20:53 am | |
| List: | org.apache.logging.log4j-user | |
Tony,
Can you describe the concrete use case? Forget about the actual logger objects for a second. Do you want logging from methodA+utilityMethod and methodB+utilityMethod to go to different places? Or do you basically want utilityMethod to inherit its logging context from some parent object?
At 03:11 PM 6/8/2004, Tony Thompson wrote:
That is not really what I want. Let me expand my example a bit:
void methodA() { Logger logger = LogManager.getLogger( "methodA" ); utilityMethod( ... ); ... }
void methodB() { Logger logger = LogManager.getLogger( "methodB" ); utilityMethod( ... ); ... }
void utilityMethod() { // Which logger do I use? }
The NDC only gives me a way to put context sensitive information in the logging statements. What I want is a way to get a Logger based on some type of logging context. In my example, I want fine grained control of my logging categories but, utilityMethod() may be called from different places. Here is what I would like to see:
void methodA() { Logger logger = LogManager.pushLoggingContext( "methodA" ); utilityMethod( ... ); ... LogManager.popLoggingContext(); }
void methodB() { Logger logger = LogManager.pushLoggingContext( "methodB" ); utilityMethod( ... ); ... LogManager.popLoggingContext(); }
void utilityMethod() { // Use the current logger. Logger logger = LogManager.getLoggingContext(); }
This, of course, could go on further too. utilityMethod() could change the current Logger before it calls some other method, etc.
Make sense? Tony
-- Ceki Gülcü
For log4j documentation consider "The complete log4j manual" ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp







