logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Williams <nicho...@nicholaswilliams.net>
Subject LoggingException vs. AppenderRuntimeException vs. ConfigurationException
Date Wed, 17 Jul 2013 18:23:20 GMT
I'm working on better exception handling in the DB appenders, and then I'll see if other appenders
are using best practices, too.

Log4j 2 defines three different exceptions: LoggingException in the API and AppenderRuntimeException
and ConfigurationException in Core.

I've pretty much figured out that my appenders, if they must wrap a checked exception thrown
by the storage mechanism _when logging an event_, should use LoggingException (since it's
the only one in the API).

But I'm unclear on the purpose of AppenderRuntimeException vs ConfigurationException. What
is AppenderRuntimeException even for? Neither of these exceptions have any Javadoc (which
I intend to fix once we all agree what their purpose is). A couple of appenders are using
AppenderRuntimeException instead of LoggingException in the append() method (which doesn't
seem right to me).

My particular use case is that my JDBCDatabaseManager's connectInternal and disconnectInternal
methods execute code that throws SQLException. I need to catch this SQLException and wrap
it in an unchecked exception. Not sure whether a ConfigurationException (since a failure to
connect is likely related to configuration) or an AppenderRuntimeException should be used


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

View raw message