// use a temp variable so that 'logger' may be 'final'
Logger tempLogger=null;
try {
tempLogger = getLoggerUsingLogDomainsAPI();
if (tempLogger == null) {
System.out.println("Could not initialize LogDomains logger");
}
} catch (Exception ex) {
System.out.println("Could not initialize LogDomains logger");
}
if (tempLogger == null) {
try {
tempLogger = getLoggerUsingJavaLoggingAPI();
if (tempLogger == null) {
System.out.println("Could not initialize JDK logger");
}
} catch (Exception ex) {
System.out.println("Could not initialize JDK logger");
ex.printStackTrace();
}
}
logger = tempLogger;
Class logDomainsClass = Class.forName(LOGDOMAINS_CLASS_NAME);
Class [] parameterClasses = new Class[1];
parameterClasses[0] = String.class;
Method getLoggerMethod = logDomainsClass.getDeclaredMethod(
GET_LOGGER_METHOD_NAME, parameterClasses);
Field orbLoggerNameField = logDomainsClass.getDeclaredField(
ORB_LOGGER_FIELD_NAME);
String orbLoggerName = (String)orbLoggerNameField.get(null);
Object [] parameters = new Object[1];
parameters[0] = orbLoggerName;
Logger lgr = (Logger)getLoggerMethod.invoke(null, parameters);
return lgr;