Improve diagnostics when underlying lib throws InvocationTargetException.
Patch provided by Lilliane E. Blaze. See Jira issue LOGGING-111. git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk@476772 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -1362,6 +1362,29 @@ public class LogFactoryImpl extends LogFactory {
|
|||||||
+ logAdapterClassName + "' -- "
|
+ logAdapterClassName + "' -- "
|
||||||
+ discoveryFlaw.getClass().getName() + ": "
|
+ discoveryFlaw.getClass().getName() + ": "
|
||||||
+ discoveryFlaw.getLocalizedMessage());
|
+ discoveryFlaw.getLocalizedMessage());
|
||||||
|
|
||||||
|
if (discoveryFlaw instanceof InvocationTargetException ) {
|
||||||
|
// Ok, the lib is there but while trying to create a real underlying
|
||||||
|
// logger something failed in the underlying lib; display info about
|
||||||
|
// that if possible.
|
||||||
|
InvocationTargetException ite = (InvocationTargetException)discoveryFlaw;
|
||||||
|
Throwable cause = ite.getTargetException();
|
||||||
|
if (cause != null) {
|
||||||
|
logDiagnostic("... InvocationTargetException: " +
|
||||||
|
cause.getClass().getName() + ": " +
|
||||||
|
cause.getLocalizedMessage());
|
||||||
|
|
||||||
|
if (cause instanceof ExceptionInInitializerError) {
|
||||||
|
ExceptionInInitializerError eiie = (ExceptionInInitializerError)cause;
|
||||||
|
Throwable cause2 = eiie.getException();
|
||||||
|
if (cause2 != null) {
|
||||||
|
logDiagnostic("... ExceptionInInitializerError: " +
|
||||||
|
cause2.getClass().getName() + ": " +
|
||||||
|
cause2.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!allowFlawedDiscovery) {
|
if (!allowFlawedDiscovery) {
|
||||||
|
|||||||
Reference in New Issue
Block a user