Skip to content

Commit

Permalink
Fix no stacktrace is outputed in server log when exception occurs in …
Browse files Browse the repository at this point in the history
…class specified by Lifecycle Module

Signed-off-by: kaido207 <kaido.hiroki@fujitsu.com>
  • Loading branch information
kaido207 committed Feb 2, 2024
1 parent 341b02b commit 3b9d280
Showing 1 changed file with 5 additions and 4 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Contributors to the Eclipse Foundation
* Copyright (c) 2023, 2024 Contributors to the Eclipse Foundation
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -36,6 +36,7 @@
import com.sun.appserv.server.LifecycleListener;
import com.sun.appserv.server.ServerLifecycleException;
import com.sun.enterprise.util.LocalStringManagerImpl;
import org.glassfish.api.logging.LogHelper;

/**
* @author Sridatta Viswanath
Expand Down Expand Up @@ -120,7 +121,7 @@ LifecycleListener loadServerLifecycle() throws ServerLifecycleException {
Class<LifecycleListener> clazz = (Class<LifecycleListener>) Class.forName(className, true, classLoader);
slcl = clazz.getDeclaredConstructor().newInstance();
} catch (Exception ee) {
_logger.log(Level.SEVERE, KernelLoggerInfo.exceptionLoadingLifecycleModule, new Object[] { this.name, ee });
LogHelper.log(_logger, Level.SEVERE, KernelLoggerInfo.exceptionLoadingLifecycleModule, ee, new Object[] { this.name, ee });
if (isFatal) {
throw new ServerLifecycleException(localStrings.getLocalString("lifecyclemodule.loadExceptionIsFatal",
"Treating failure loading the lifecycle module as fatal", this.name));
Expand Down Expand Up @@ -153,12 +154,12 @@ private void postEvent(int eventType, Object data) throws ServerLifecycleExcepti
try {
slcl.handleEvent(slcEvent);
} catch (ServerLifecycleException sle) {
_logger.log(Level.WARNING, KernelLoggerInfo.serverLifecycleException, new Object[] { this.name, sle });
LogHelper.log(_logger, Level.WARNING, KernelLoggerInfo.serverLifecycleException, sle, new Object[] { this.name, sle });
if (isFatal) {
throw sle;
}
} catch (Exception ee) {
_logger.log(Level.WARNING, KernelLoggerInfo.lifecycleModuleException, new Object[] { this.name, ee });
LogHelper.log(_logger, Level.WARNING, KernelLoggerInfo.lifecycleModuleException, ee, new Object[] { this.name, ee });
if (isFatal) {
throw new ServerLifecycleException(localStrings.getLocalString("lifecyclemodule.event_exceptionIsFatal",
"Treating the exception from lifecycle module event handler as fatal"), ee);
Expand Down

0 comments on commit 3b9d280

Please sign in to comment.