Re: looking for source

2016-11-05 Thread Ralph Goers
If you look at PatternLayout you will see a few choices for how the Exception gets formatted. %ex uses printStackTrace to format the Exception, however that is not the default. We extend the stack trace to also include the source of each class (i.e. the jar or class directory) and its version,

Re: looking for source

2016-11-05 Thread Remko Popma
I will update the javadoc on the LogEvent interface to mention that Layouts and Appenders should get the Throwable from the event and that the Message object may not be the instance initially used in the Logger API to capture the message parameters and Throwable. Sent from my iPhone > On 6

Re: looking for source

2016-11-05 Thread Nicholas Duane
Thanks, I'll check out the link you provided. I guess since log4j2 exposes: logger.error(String message); and logger.error(String message, Throwable t); As well as a bunch of others, I wasn't sure if it was the logging framework that did the work of composing a single message out of the

Re: looking for source

2016-11-05 Thread Remko Popma
Nick, If you want to combine the formatted message string and the stack trace into a single string in your layout then yes, that is one way to do that. For reference, take a look at the MessagePatternConverter and ThrowablePatternConverter (used by Log4j's PatternLayout):

Re: looking for source

2016-11-05 Thread Nicholas Duane
Thanks. I have no problem doing that. Just wondering what needs to be done and how? I guess I was hoping that the logging framework, eg. log4j, handled combining the message and the exception such that no matter what appender/layout you used you'd get consistent results. Sounds like that's

Re: looking for source

2016-11-05 Thread Remko Popma
The point is that in a custom layout/appender you should get the throwable from the LogEvent, not from the Message. That is the design that all Layouts and Appenders follow and should follow. The Message object passed to the Layout may no longer have the Throwable. Sent from my iPhone > On

Re: looking for source

2016-11-05 Thread Nicholas Duane
Thanks for the info. Unfortunately I'm not following. If someone can point me to the source in question I will certainly look it over. My sample outputs the message (%msg) and when the method logger.error(String message, Throwable t) is called it seems some code is combining the supplied