You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2018/04/02 18:48:09 UTC

logging-log4j2 git commit: [LOG4J2-2302] Status logger should show the Log4j name and version when initializing itself.

Repository: logging-log4j2
Updated Branches:
  refs/heads/release-2.x 6008c71ec -> c0f1400c3


[LOG4J2-2302] Status logger should show the Log4j name and version when
initializing itself.

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/c0f1400c
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/c0f1400c
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/c0f1400c

Branch: refs/heads/release-2.x
Commit: c0f1400c347cf30d9b36d3ed07a28772bba93b93
Parents: 6008c71
Author: Gary Gregory <ga...@gmail.com>
Authored: Mon Apr 2 12:47:58 2018 -0600
Committer: Gary Gregory <ga...@gmail.com>
Committed: Mon Apr 2 12:47:58 2018 -0600

----------------------------------------------------------------------
 .../org/apache/logging/log4j/core/Version.java  | 34 ++++++++++++++++++++
 .../core/config/AbstractConfiguration.java      |  5 +--
 src/changes/changes.xml                         |  3 ++
 3 files changed, 40 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c0f1400c/log4j-core/src/main/java/org/apache/logging/log4j/core/Version.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/Version.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/Version.java
new file mode 100644
index 0000000..afab5c9
--- /dev/null
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/Version.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+
+package org.apache.logging.log4j.core;
+
+public class Version {
+
+	public static void main(final String[] args) {
+		System.out.println(getProductString());
+	}
+	
+	public static String getProductString() {
+		final Package pkg = Version.class.getPackage();
+		if (pkg == null) {
+			return "Apache Log4j";
+		}
+		return String.format("%s %s", pkg.getSpecificationTitle(), pkg.getSpecificationVersion());
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c0f1400c/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java
index 3c0e810..1326285 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java
@@ -43,6 +43,7 @@ import org.apache.logging.log4j.core.Layout;
 import org.apache.logging.log4j.core.LifeCycle2;
 import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.LoggerContext;
+import org.apache.logging.log4j.core.Version;
 import org.apache.logging.log4j.core.appender.AsyncAppender;
 import org.apache.logging.log4j.core.appender.ConsoleAppender;
 import org.apache.logging.log4j.core.async.AsyncLoggerConfig;
@@ -209,7 +210,7 @@ public abstract class AbstractConfiguration extends AbstractFilterable implement
      */
     @Override
     public void initialize() {
-        LOGGER.debug("Initializing configuration {}", this);
+        LOGGER.debug(Version.getProductString() + " initializing configuration {}", this);
         subst.setConfiguration(this);
         try {
             scriptManager = new ScriptManager(this, watchManager);
@@ -239,7 +240,7 @@ public abstract class AbstractConfiguration extends AbstractFilterable implement
         LOGGER.debug("Configuration {} initialized", this);
     }
 
-    /**
+	/**
      * Start the configuration.
      */
     @Override

http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/c0f1400c/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index ab195aa..3b4e6cc 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -40,6 +40,9 @@
       <action issue="LOG4J2-2300" dev="ggregory" type="fix">
         PoolingDriverConnectionSource does not take into account properties, user name, and password.
       </action>
+      <action issue="LOG4J2-2302" dev="ggregory" type="update">
+        Status logger should show the Log4j name and version when initializing itself.
+      </action>
     </release>
     <release version="2.11.0" date="2018-03-11" description="GA Release 2.11.0">
       <action issue="LOG4J2-2104" dev="rgoers" type="fix">