Author: violetagg
Date: Mon Oct 20 13:57:30 2014
New Revision: 1633158
URL: http://svn.apache.org/r1633158
Log:
Merged revisions 1627296, 1627569 from tomcat/trunk:
- Alternative solution for BZ56401 that doesn't trigger logging on shutdown
- Improve the previous fix .
Avoid logging version information in the constructor since it then gets logged
at undesirable times such as when using StoreConfig
Added:
tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/VersionLoggerListener.java
- copied, changed from r1627296,
tomcat/trunk/java/org/apache/catalina/startup/VersionLoggerListener.java
Modified:
tomcat/tc7.0.x/trunk/ (props changed)
tomcat/tc7.0.x/trunk/conf/server.xml
tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AprLifecycleListener.java
tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/LocalStrings.properties
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
tomcat/tc7.0.x/trunk/webapps/docs/config/listeners.xml
Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
Merged /tomcat/trunk:r1627296,1627569
Modified: tomcat/tc7.0.x/trunk/conf/server.xml
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/conf/server.xml?rev=1633158&r1=1633157&r2=1633158&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/conf/server.xml (original)
+++ tomcat/tc7.0.x/trunk/conf/server.xml Mon Oct 20 13:57:30 2014
@@ -20,6 +20,7 @@
Documentation at /docs/config/server.html
-->
<Server port="8005" shutdown="SHUTDOWN">
+ <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
<!-- Security listener. Documentation at /docs/config/listeners.html
<Listener className="org.apache.catalina.security.SecurityListener" />
-->
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AprLifecycleListener.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AprLifecycleListener.java?rev=1633158&r1=1633157&r2=1633158&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AprLifecycleListener.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/AprLifecycleListener.java
Mon Oct 20 13:57:30 2014
@@ -20,6 +20,8 @@ package org.apache.catalina.core;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleEvent;
@@ -47,6 +49,13 @@ public class AprLifecycleListener
private static final Log log =
LogFactory.getLog(AprLifecycleListener.class);
private static boolean instanceCreated = false;
/**
+ * Info messages during init() are cached until Lifecycle.BEFORE_INIT_EVENT
+ * so that, in normal (non-error) cases, init() releated log messages
appear
+ * at the expected point in the lifecycle.
+ */
+ private static final List<String> initInfoLogMessages = new
ArrayList<String>(3);
+
+ /**
* The string manager for this package.
*/
protected static final StringManager sm =
@@ -119,6 +128,10 @@ public class AprLifecycleListener
if (Lifecycle.BEFORE_INIT_EVENT.equals(event.getType())) {
synchronized (lock) {
init();
+ for (String msg : initInfoLogMessages) {
+ log.info(msg);
+ }
+ initInfoLogMessages.clear();
if (aprAvailable) {
try {
initializeSSL();
@@ -199,7 +212,7 @@ public class AprLifecycleListener
} catch (Throwable t) {
t = ExceptionUtils.unwrapInvocationTargetException(t);
ExceptionUtils.handleThrowable(t);
- log.info(sm.getString("aprListener.aprInit",
+ initInfoLogMessages.add(sm.getString("aprListener.aprInit",
System.getProperty("java.library.path")));
return;
}
@@ -220,21 +233,21 @@ public class AprLifecycleListener
return;
}
if (apver < rcver) {
- log.info(sm.getString("aprListener.tcnVersion", major + "."
- + minor + "." + patch,
+ initInfoLogMessages.add(sm.getString("aprListener.tcnVersion",
+ major + "." + minor + "." + patch,
TCN_REQUIRED_MAJOR + "." +
TCN_RECOMMENDED_MINOR + "." +
TCN_RECOMMENDED_PV));
}
- log.info(sm.getString("aprListener.tcnValid", major + "."
- + minor + "." + patch,
- Library.APR_MAJOR_VERSION + "."
- + Library.APR_MINOR_VERSION + "."
- + Library.APR_PATCH_VERSION));
+ initInfoLogMessages.add(sm.getString("aprListener.tcnValid",
+ major + "." + minor + "." + patch,
+ Library.APR_MAJOR_VERSION + "." +
+ Library.APR_MINOR_VERSION + "." +
+ Library.APR_PATCH_VERSION));
// Log APR flags
- log.info(sm.getString("aprListener.flags",
+ initInfoLogMessages.add(sm.getString("aprListener.flags",
Boolean.valueOf(Library.APR_HAVE_IPV6),
Boolean.valueOf(Library.APR_HAS_SENDFILE),
Boolean.valueOf(Library.APR_HAS_SO_ACCEPTFILTER),
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/LocalStrings.properties
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/LocalStrings.properties?rev=1633158&r1=1633157&r2=1633158&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/LocalStrings.properties
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/LocalStrings.properties
Mon Oct 20 13:57:30 2014
@@ -140,6 +140,14 @@ userConfig.error=Error deploying web app
userConfig.start=UserConfig: Processing START
userConfig.stop=UserConfig: Processing STOP
userConfig.deploy.threaded.error=Error waiting for multi-thread deployment of
user directories to complete
+versionLoggerListener.serverInfo.server.version=Server version: {0}
+versionLoggerListener.serverInfo.server.built =Server built: {0}
+versionLoggerListener.serverInfo.server.number =Server number: {0}
+versionLoggerListener.serverInfo.os.name =OS Name: {0}
+versionLoggerListener.serverInfo.os.version =OS Version: {0}
+versionLoggerListener.serverInfo.os.arch =Architecture: {0}
+versionLoggerListener.serverInfo.vm.version =JVM Version: {0}
+versionLoggerListener.serverInfo.vm.vendor =JVM Vendor: {0}
webAnnotationSet.invalidInjection=Invalid method resource injection annotation.
webRuleSet.absoluteOrdering=<absolute-ordering> element not valid in
web-fragment.xml and will be ignored
webRuleSet.absoluteOrderingCount=<absolute-ordering> element is limited to 1
occurrence
Copied:
tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/VersionLoggerListener.java
(from r1627296,
tomcat/trunk/java/org/apache/catalina/startup/VersionLoggerListener.java)
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/VersionLoggerListener.java?p2=tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/VersionLoggerListener.java&p1=tomcat/trunk/java/org/apache/catalina/startup/VersionLoggerListener.java&r1=1627296&r2=1633158&rev=1633158&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/VersionLoggerListener.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/VersionLoggerListener.java
Mon Oct 20 13:57:30 2014
@@ -16,6 +16,7 @@
*/
package org.apache.catalina.startup;
+import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleListener;
import org.apache.catalina.util.ServerInfo;
@@ -36,18 +37,11 @@ public class VersionLoggerListener imple
protected static final StringManager sm =
StringManager.getManager(Constants.Package);
- public VersionLoggerListener() {
- // The log message is generated here to ensure that it appears before
- // any log messages from the APRLifecycleListener. This won't be logged
- // on shutdown because only the Server element in server.xml is
- // processed on shutdown.
- log();
- }
-
-
@Override
public void lifecycleEvent(LifecycleEvent event) {
- // NO-OP
+ if (Lifecycle.BEFORE_INIT_EVENT.equals(event.getType())) {
+ log();
+ }
}
Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1633158&r1=1633157&r2=1633158&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Mon Oct 20 13:57:30 2014
@@ -58,6 +58,10 @@
<section name="Tomcat 7.0.57 (violetagg)">
<subsection name="Catalina">
<changelog>
+ <add>
+ <bug>56401</bug>: Log version information when Tomcat starts.
+ (markt/kkolinko)
+ </add>
<fix>
<bug>57022</bug>: Ensure SPNEGO authentication continues to work with
the JNDI Realm using delegated credentials with recent Oracle JREs.
@@ -72,6 +76,11 @@
resource. The context.xml having an external docBase has already been
registered as a redeploy resources at first. (kfujino)
</fix>
+ <fix>
+ Improve the previous fix for <bug>56401</bug>. Avoid logging version
+ information in the constructor since it then gets logged at undesirable
+ times such as when using <code>StoreConfig</code>. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
Modified: tomcat/tc7.0.x/trunk/webapps/docs/config/listeners.xml
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/config/listeners.xml?rev=1633158&r1=1633157&r2=1633158&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/config/listeners.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/config/listeners.xml Mon Oct 20 13:57:30
2014
@@ -403,6 +403,19 @@
</subsection>
+ <subsection name="Version Logging Lifecycle Listener -
org.apache.catalina.startup.VersionLoggerListener">
+
+ <p>The <strong>Version Logging Lifecycle Listener</strong> logs Tomcat,
Java
+ and operating system information when Tomcat starts.</p>
+
+ <p>This listener must only be nested within <a
href="server.html">Server</a>
+ elements and should be the first listener defined.</p>
+
+ <p>No additional attributes are supported by the <strong>Version Logging
+ Lifecycle Listener</strong>.</p>
+
+ </subsection>
+
</section>
<section name="Additional Implementations">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]