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 Cyrille Le Clerc <cl...@apache.org> on 2010/03/12 23:24:20 UTC

Proposal : 48902 - Enhancement : add %throwable{compact} to EnhancedPatternLayout

   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
cleclerc@apache.org
cleclerc@xebia.fr


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: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Proposal : 48902 - Enhancement : add %throwable{compact} to EnhancedPatternLayout

Posted by Cyrille Le Clerc <cl...@apache.org>.
Thanks for your interest in this contribution.

I am at your disposal to enhance it.

Cyrille

On Tue, Mar 16, 2010 at 2:39 PM, Curt Arnold <ca...@apache.org> wrote:
>
> Thanks for your contribution.  I'm currently working on modifying the EnhancedPatternLayout tests so that EnhancedPatternLayout and its tests can be integrated into log4j core.  I'll take a look at your patch as soon as I get all the tests working again.
>
>
> On Mar 12, 2010, at 4:24 PM, Cyrille Le Clerc wrote:
>
> >   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
> > cleclerc@apache.org
> > cleclerc@xebia.fr
> >
> >
> > 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: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>

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


Re: Proposal : 48902 - Enhancement : add %throwable{compact} to EnhancedPatternLayout

Posted by Curt Arnold <ca...@apache.org>.
Thanks for your contribution.  I'm currently working on modifying the EnhancedPatternLayout tests so that EnhancedPatternLayout and its tests can be integrated into log4j core.  I'll take a look at your patch as soon as I get all the tests working again.


On Mar 12, 2010, at 4:24 PM, Cyrille Le Clerc wrote:

>   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
> cleclerc@apache.org
> cleclerc@xebia.fr
> 
> 
> 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: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 


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