THIS IS NOT A CONTRIBUTION.
Sorry, our lawyer requires me to do this.
> Mike,
>
> ObjectRendering is not automatically applied to the second argument of
> printing methods but only to the first one (the message). Would you
> care to explain how you'd like exceptions to be displayed?
Sure.
We have a server application written in a JMX framework. We often have
Exceptions which wrap other Exceptions as their "cause". We have written an
ExceptionIterator which will traverse the entire Exception getCause() graph,
(including the many JMX types which have getTargetException(), and
SQLException's getNextException(). In the log for general ERROR level we print
just the Exception's message, and if the DEBUG level is turned on we also print
the stack trace of the root (or originating) cause.
For example:
10 Dec 2004 09:19:56,570 1582 [main] ERROR CCCEngine -
CCTR023E Start Service failed. Service:
Agent:Name=CCEngineService,Type=0
---> nested javax.management.MBeanException: Exception thrown in
operation start
---> nested CSVC001E Initialization failed. Service: CCenter
---> nested CCTR027E Error Starting Services.
---> nested CCTR014E Error while loading services.
---> nested CCTR024E Init Service failed. Service:
System:Name=RuleService,Type=Rule
---> nested javax.management.MBeanException: Exception thrown in
operation init
---> nested CSVC001E Initialization failed. Service: Rule Service
---> nested CRUL089E Error occurred while merging rules.
---> nested CRUL009E Error while loading rule.
---> nested CRUL005E IO Error while writing rule: <?xml version="1.0"
encoding="UTF-8"?>
---> nested CXML001E Error while converting XML string to XML document.
---> nested org.xml.sax.SAXParseException: The element type "actionId"
must be terminated by the matching end-tag "</actionId>".
>
> BTW, if you are using log4j 1.3 and PatternLayout, you can register a
> pattern converter for exceptions. PatternLayout will delegate
> displaying the exception to your converter and the containing appender
> will honor your custom treatment of the exception.
I'll look into, we're currently at log4j 1.2.8. Are there some examples I can
follow?
Thanks,
Mike
>
> At 03:56 PM 12/10/2004, Rieser, Michael (SCI TW) wrote:
> >Is it possible to override the default logging behavior of
> >Exceptions/Throwables?
> >
> >I've been able to get ObjectRenderers to work for the
> logging signatures
> >like the following:
> > logger.debug(new Exception("error message");
> >
> >but those which take the throwable as an additional argument
> don't seem to
> >obey the Renderer
> > logger.debug("error message", new Exception("won't
> be rendered
> > the way I want");
> >
> >Any help would be appreciated.
> >
> >Thanks,
> >Mike
>
> --
> Ceki G�lc�
>
> The complete log4j manual: http://qos.ch/log4j/
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
THIS IS NOT A CONTRIBUTION.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]