From: kkolinko Date: Sat, 1 May 2010 16:00:29 +0000 (+0000) Subject: Log any unexpected errors that might occur during server shutdown from the shutdown... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=5082a66674e1e8dd494b7b2284ae993bcb9676ed;p=tomcat7.0 Log any unexpected errors that might occur during server shutdown from the shutdown hook, and do not forget to shutdown (read: flush) the logging subsystem. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@940064 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/startup/Catalina.java b/java/org/apache/catalina/startup/Catalina.java index 670516a97..2b366f0d1 100644 --- a/java/org/apache/catalina/startup/Catalina.java +++ b/java/org/apache/catalina/startup/Catalina.java @@ -778,16 +778,19 @@ public class Catalina { @Override public void run() { - - if (getServer() != null) { - Catalina.this.stop(); - } - - // If JULI is used, shut JULI down *after* the server shuts down - // so log messages aren't lost - LogManager logManager = LogManager.getLogManager(); - if (logManager instanceof ClassLoaderLogManager) { - ((ClassLoaderLogManager) logManager).shutdown(); + try { + if (getServer() != null) { + Catalina.this.stop(); + } + } catch (Throwable ex) { + log.error(sm.getString("catalina.shutdownHookFail"), ex); + } finally { + // If JULI is used, shut JULI down *after* the server shuts down + // so log messages aren't lost + LogManager logManager = LogManager.getLogManager(); + if (logManager instanceof ClassLoaderLogManager) { + ((ClassLoaderLogManager) logManager).shutdown(); + } } } } diff --git a/java/org/apache/catalina/startup/LocalStrings.properties b/java/org/apache/catalina/startup/LocalStrings.properties index 9536ffffd..c9af91a43 100644 --- a/java/org/apache/catalina/startup/LocalStrings.properties +++ b/java/org/apache/catalina/startup/LocalStrings.properties @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +catalina.shutdownHookFail=The shutdown hook experienced an error while trying to stop the server catalina.stopServer=No shutdown port configured. Shut down server through OS signal. Server not shut down. contextConfig.altDDNotFound=alt-dd file {0} not found contextConfig.applicationUrl=Unable to determine URL for application web.xml