directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Knecht <fel...@apache.org>
Subject Re: Exception Logging
Date Thu, 03 Jun 2010 21:33:18 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 06/03/10 23:15, Felix Knecht wrote:
> We have a lot of following constructs:
> 
> log.error( I18n.err( I18n.ERR_04007 ) );
> throw new DecoderException( I18n.err( I18n.ERR_04007 ) );
> 
> What about logging the exception within the exception itself like
> 
> public DecoderException(String message)
> {
>     super( message );
>     log.error( message );

log.error( message, this ); // to have also the location where the
exception happend.

> }
> 
> 
> This will avoid having log.error all over the place and the translation
> must be done only once instead of twice like above.
> 
> Regards
> Felix
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwIH54ACgkQ2lZVCB08qHF3XACg0zklDOjBfOhP6rh7ZCzmaybH
7MMAoIcB+ldaB1gIDbperFMx0XD9QSqI
=3l2A
-----END PGP SIGNATURE-----

Mime
View raw message