public SessionLog getServerLog() {
return createSessionLog();
}
protected SessionLog createSessionLog() {
SessionLog log = null;
try {
if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()) {
log = AccessController.doPrivileged(new PrivilegedExceptionAction<SessionLog>() {
@Override
public SessionLog run() throws Exception {
Class<?> cls = PrivilegedAccessHelper.getClassForName(SERVER_LOG_CLASS);
Constructor<SessionLog> ctor = PrivilegedAccessHelper.getConstructorFor(cls, null, false);
return ctor.newInstance();
}
});
} else {
Class<?> cls = PrivilegedAccessHelper.getClassForName(SERVER_LOG_CLASS);
Constructor<SessionLog> ctor = PrivilegedAccessHelper.getConstructorFor(cls, null, false);
log = ctor.newInstance();
}
} catch (Exception e) {
// Blindly catch exception here as there is no recourse for any specific exception. If
// we can't load the WAS logger just fall back to using the default SessionLog.
log = super.getServerLog();
log.log(SessionLog.FINEST, "Unable to create an instance of " + SERVER_LOG_CLASS
+ ". Falling back to using default logger.", e);
}
return log;
}