tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mario Ivankovits <>
Subject log and throw exception [was: Re: svn commit: r656124 - /tomcat/trunk/java/org/apache/tomcat/util/net/jsse/]
Date Wed, 14 May 2008 07:30:14 GMT
>          } catch (FileNotFoundException fnfe) {
>              log.error(sm.getString("jsse.keystore_load_failed", type, path,
> -                    fnfe.getMessage()));
> +                    fnfe.getMessage()), fnfe);
>              throw fnfe;
>          } catch (IOException ioe) {
>              log.error(sm.getString("jsse.keystore_load_failed", type, path,
> -                    ioe.getMessage()));
> +                    ioe.getMessage()), ioe);
>              throw ioe;      

I'd like to ask if it is really required to log the exception and throw
it too. Code like this will lead to logfile flooding as normally there
is some exception handling outside of the method which then handle the
exception, rethrow it, or purge it - then with logging of the exception.

I think there is no need to log the exception if you rethrow it. If
everyone along the stack rethrowing an exception also logs it, it will
be hard to read the logs, no?

Probably you can change the message so that it comes to something like:

catch (FileNotFoundException fnfe)
    throw new FileNotFoundException(sm.getString(.....), fnfe);


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message