I knew about the location info stuff, but this applies to all messages
logged, and that will clearly affect performance even more than doing it
for just a few log messages. Also, the location info does not include
the entire stack trace, thus making it difficult to trace the entire
chain of
Hmm, you are not aware of the debug(Object, Throwable) method in
Logger class, are you? You can just write:
log.debug(genereting stack trace, new Exception());
At 15:10 01.08.2002 +0200, you wrote:
I knew about the location info stuff, but this applies to all messages
logged, and
my implementation (residing in a class called Debug) is
very rough so,
it needs a bit of cleaning up to fit well into log4j:
public static void logStackTrace(org.apache.log4j.Logger log)
{
try {
throw new Exception();
} catch (Exception e) {
StringWriter
Logging events also support something called location info. It records
where the event was logged from and can be displayed via the PatternLayout
(see the javadoc for details). It displays the stack from where the logging
event was recorded. All you have to do is use the correct conversion