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 "Alexander,D" <D....@lse.ac.uk> on 2004/01/15 16:56:55 UTC

formatting stack trace (with SyslogAppender)

Hi,

I'm quite new to log4j but have looked through the web pages and 'The complete log4j manual' and can't see any solution mentioned to the problem I'm facing so wondered if anyone else has had a similar experience and could perhaps advise as to how they worked around it.

I'll be using the SyslogAppender with multiple web apps, all will be using same facility (there aren't enough permitted facilities for each hosted app to have its own) so our syslog server will be processing messages based on other tokens in the message it receives.

It is easy to put such tokens into each log message using a PatternLayout however where the LoggingEvent contains a Throwable the SyslogAppender seems to send a syslog message for each line of the stack trace. The only info added to each log message before sending is the facility name.

It does not seem possible to turn off this default handling of Throwables. I was expectng this would have been configurable by handling them in a Layout and making the Layout ignoresThrowable() return false. Am I missing something here?

Having looked at the source, of SyslogAppender, the easiest way I can see to get around these problems is to subclass it and override append(LoggingEvent event). My intention would be to use my layout to format each line of the exception prior to sending them to the SyslogQuietWriter.

Does this sound like a reasonable approach or can someone recommend another way? While this isn't particulary difficult to do, I'm concerned that this approach may not be the best in the long term.

Thanks,
Derek



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