You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Venkatray Kamath <Ve...@tavant.com> on 2005/09/14 13:00:33 UTC

limitations of NDC

Hi,
 
NDC has a limitation wherein you can only push/pop String objects. I have a
requirement wherein I need to dump the Contextual info stack onto the log
file only when an exception occurs. In order to fulfill this requirement and
implement it efficiently, I would like to avoid expensive toString() calls
which needs to be executed on contextual info objects before pushing onto
NDC. Whereas, I would like to execute toString() on each object on the NDC
stack only in case an exception is thrown in the code. (I use AOP to catch
all exceptions at the base layer and dump the NDC stack onto log file)
Is there a workaround for this? 
 
Or are there any plans to enhance NDC to accommodate generic Object Types
instead of just Strings.
 
Would really appreciate your thoughts.
 
Thanks & Regards,
Venkat

Re: limitations of NDC

Posted by Hein Meling <me...@acm.org>.
Hi,

Not sure I fully grasp your scenario, but it sort of looks like a 
problem I had with a signature change with MDC in log4j v1.3alpha. Maybe 
you could add a comment to the bug report:

http://issues.apache.org/bugzilla/show_bug.cgi?id=32752

I expect that the above bug will be fixed before 1.3 is released.

Hein

Venkatray Kamath wrote:
> Hi,
>  
> NDC has a limitation wherein you can only push/pop String objects. I have a
> requirement wherein I need to dump the Contextual info stack onto the log
> file only when an exception occurs. In order to fulfill this requirement and
> implement it efficiently, I would like to avoid expensive toString() calls
> which needs to be executed on contextual info objects before pushing onto
> NDC. Whereas, I would like to execute toString() on each object on the NDC
> stack only in case an exception is thrown in the code. (I use AOP to catch
> all exceptions at the base layer and dump the NDC stack onto log file)
> Is there a workaround for this? 
>  
> Or are there any plans to enhance NDC to accommodate generic Object Types
> instead of just Strings.
>  
> Would really appreciate your thoughts.
>  
> Thanks & Regards,
> Venkat
>
>   



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org