Dear all,

   I have used for more than one year an enhancement of
EnhancedPatternLayout I would be very happy to give back to the Log4j
project.

   I proposed in "defect 48902 - add %throwable{compact} to
EnhancedPatternLayout" an intermediate pattern which concatenates the
class name and the message of the throwable and its causes to render
them on the same line as the log message (see sample below). I find
this very useful for chained exceptions.

  If the project is interested in this contribution, I would be very
pleased to iterate on the attached patch to meet the project standard.

   Cyrille
--
Cyrille Le Clerc
[email protected]
[email protected]


https://issues.apache.org/bugzilla/show_bug.cgi?id=48902

SAMPLES
======

NONE
-----

log4j.appender.stdout.layout.ConversionPattern=%d{yyyy/MM/dd HH:mm:ss,SSS} %5p
[%t] %c - %m %throwable{none} %n

2010/03/12 18:39:00,083 ERROR [main] my-category - An exception occured

SHORT
-----

log4j.appender.stdout.layout.ConversionPattern=%d{yyyy/MM/dd HH:mm:ss,SSS} %5p
[%t] %c - %m %throwable{short} %n

2010/03/12 18:37:34,580 ERROR [main] my-category - An exception occured
java.io.IOException: Exception invoking http://example.com/


COMPACT
--------

log4j.appender.stdout.layout.ConversionPattern=%d{yyyy/MM/dd HH:mm:ss,SSS} %5p
[%t] %c - %m %throwable{compact} %n

2010/03/12 18:35:34,934 ERROR [main] my-category - An exception occured  -
java.io.IOException: Exception invoking http://example.com/
java.net.SocketTimeoutException: Read timed out

STANDARD
---------

log4j.appender.stdout.layout.ConversionPattern=%d{yyyy/MM/dd HH:mm:ss,SSS} %5p
[%t] %c - %m %throwable %n

2010/03/12 18:40:01,930 ERROR [main] my-category - An exception occured
java.io.IOException: Exception invoking http://example.com/
    at ExceptionTest.main(ExceptionTest.java:11)
Caused by: java.net.SocketTimeoutException: Read timed out
    ... 1 more

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to