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 2022/01/05 16:13:14 UTC

[logging-log4j2] branch master updated (d5ad6c3 -> c5d0202)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git.


    from d5ad6c3  Fix test on Windows.
     new a5cc97d  Log4j 1.2 bridge adds org.apache.log4j.helpers.LogLog.
     new 588b1a6  Log4j 1.2 bridge adds org.apache.log4j.helpers.LogLog.
     new c5d0202  Fix indentation.

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../main/java/org/apache/log4j/helpers/LogLog.java | 173 +++++++++++++++++++++
 src/changes/changes.xml                            |   7 +-
 2 files changed, 178 insertions(+), 2 deletions(-)
 create mode 100644 log4j-1.2-api/src/main/java/org/apache/log4j/helpers/LogLog.java

[logging-log4j2] 02/03: Log4j 1.2 bridge adds org.apache.log4j.helpers.LogLog.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit 588b1a609c0fc23d2256eb69a9312105618956d9
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Jan 5 11:12:54 2022 -0500

    Log4j 1.2 bridge adds org.apache.log4j.helpers.LogLog.
---
 src/changes/changes.xml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index fefdad1..18a1aa3 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -227,6 +227,9 @@
       <action dev="ggregory" type="fix">
        Log4j 1.2 bridge adds org.apache.log4j.component.helpers.Constants.
       </action>
+      <action dev="ggregory" type="fix">
+       Log4j 1.2 bridge adds org.apache.log4j.helpers.LogLog.
+      </action>
     </release>
     <release version="2.17.1" date="2021-MM-DD" description="GA Release 2.17.1">
       <action issue="LOG4J2-3292" dev="ckozak" type="fix">

[logging-log4j2] 01/03: Log4j 1.2 bridge adds org.apache.log4j.helpers.LogLog.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit a5cc97d33fb9c3a2e2b222ff21fd1b2a4bad953c
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Jan 5 11:06:15 2022 -0500

    Log4j 1.2 bridge adds org.apache.log4j.helpers.LogLog.
---
 .../main/java/org/apache/log4j/helpers/LogLog.java | 173 +++++++++++++++++++++
 1 file changed, 173 insertions(+)

diff --git a/log4j-1.2-api/src/main/java/org/apache/log4j/helpers/LogLog.java b/log4j-1.2-api/src/main/java/org/apache/log4j/helpers/LogLog.java
new file mode 100644
index 0000000..d40773e
--- /dev/null
+++ b/log4j-1.2-api/src/main/java/org/apache/log4j/helpers/LogLog.java
@@ -0,0 +1,173 @@
+/*
+ * 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.log4j.helpers;
+
+import org.apache.logging.log4j.status.StatusLogger;
+
+/**
+ * Logs statements from within Log4j.
+ *
+ * <p>
+ * Log4j components cannot make Log4j logging calls. However, it is sometimes useful for the user to learn about what
+ * Log4j is doing. You can enable Log4j internal logging by defining the <b>log4j.configDebug</b> variable.
+ * </p>
+ * <p>
+ * All Log4j internal debug calls go to <code>System.out</code> where as internal error messages are sent to
+ * <code>System.err</code>. All internal messages are prepended with the string "log4j: ".
+ * </p>
+ *
+ * @since 0.8.2
+ */
+public class LogLog {
+
+    private static final StatusLogger LOGGER = StatusLogger.getLogger();
+
+    /**
+     * Makes Log4j print log4j-internal debug statements to <code>System.out</code>.
+     *
+     * <p>
+     * The value of this string is {@value #DEBUG_KEY}
+     * </p>
+     * <p>
+     * Note that the search for all option names is case sensitive.
+     * </p>
+     */
+    public static final String DEBUG_KEY = "log4j.debug";
+
+    /**
+     * Makes Log4j components print log4j-internal debug statements to <code>System.out</code>.
+     *
+     * <p>
+     * The value of this string is {@value #CONFIG_DEBUG_KEY}.
+     * </p>
+     * <p>
+     * Note that the search for all option names is case sensitive.
+     * </p>
+     *
+     * @deprecated Use {@link #DEBUG_KEY} instead.
+     */
+    @Deprecated
+    public static final String CONFIG_DEBUG_KEY = "log4j.configDebug";
+
+    /**
+     * Debug enabled Enable or disable.
+     */
+    protected static boolean debugEnabled = false;
+
+    /**
+     * In quietMode not even errors generate any output.
+     */
+    private static boolean quietMode = false;
+
+    static {
+        String key = OptionConverter.getSystemProperty(DEBUG_KEY, null);
+        if (key == null) {
+            key = OptionConverter.getSystemProperty(CONFIG_DEBUG_KEY, null);
+        }
+        if (key != null) {
+            debugEnabled = OptionConverter.toBoolean(key, true);
+        }
+    }
+
+    /**
+     * Logs Log4j internal debug statements.
+     * 
+     * @param message the message object to log.
+     */
+    public static void debug(final String message) {
+        if (debugEnabled && !quietMode) {
+            LOGGER.debug(message);
+        }
+    }
+
+    /**
+     * Logs Log4j internal debug statements.
+     * 
+     * @param message the message object to log.
+     * @param throwable the {@code Throwable} to log, including its stack trace.
+     */
+    public static void debug(final String message, final Throwable throwable) {
+        if (debugEnabled && !quietMode) {
+            LOGGER.debug(message, throwable);
+        }
+    }
+
+    /**
+     * Logs Log4j internal error statements.
+     * 
+     * @param message the message object to log.
+     */
+    public static void error(final String message) {
+        if (!quietMode) {
+            LOGGER.error(message);
+        }
+    }
+
+    /**
+     * Logs Log4j internal error statements.
+     * 
+     * @param message the message object to log.
+     * @param throwable the {@code Throwable} to log, including its stack trace.
+     */
+    public static void error(final String message, final Throwable throwable) {
+        if (!quietMode) {
+            LOGGER.error(message, throwable);
+        }
+    }
+
+    /**
+     * Enables and disables Log4j internal logging.
+     *
+     * @param enabled Enable or disable.
+     */
+    static public void setInternalDebugging(final boolean enabled) {
+        debugEnabled = enabled;
+    }
+
+    /**
+     * In quite mode no LogLog generates strictly no output, not even for errors.
+     *
+     * @param quietMode A true for not
+     */
+    public static void setQuietMode(final boolean quietMode) {
+        LogLog.quietMode = quietMode;
+    }
+
+    /**
+     * Logs Log4j internal warning statements.
+     * 
+     * @param message the message object to log.
+     */
+    public static void warn(final String message) {
+        if (!quietMode) {
+            LOGGER.warn(message);
+        }
+    }
+
+    /**
+     * Logs Log4j internal warnings.
+     * 
+     * @param message the message object to log.
+     * @param throwable the {@code Throwable} to log, including its stack trace.
+     */
+    public static void warn(final String message, final Throwable throwable) {
+        if (!quietMode) {
+            LOGGER.warn(message, throwable);
+        }
+    }
+}

[logging-log4j2] 03/03: Fix indentation.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit c5d0202bd3c605a4c302e6a36c4fee5069e3ca20
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Jan 5 11:13:11 2022 -0500

    Fix indentation.
---
 src/changes/changes.xml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 18a1aa3..5bd953a 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -222,13 +222,13 @@
         Log4j 1.2 bridge missing class org.apache.log4j.or.RendererMap.
       </action>
       <action dev="ggregory" type="fix" issue="LOG4J2-3316">
-       Log4j 1.2 bridge should ignore case in properties file keys.
+        Log4j 1.2 bridge should ignore case in properties file keys.
       </action>
       <action dev="ggregory" type="fix">
-       Log4j 1.2 bridge adds org.apache.log4j.component.helpers.Constants.
+        Log4j 1.2 bridge adds org.apache.log4j.component.helpers.Constants.
       </action>
       <action dev="ggregory" type="fix">
-       Log4j 1.2 bridge adds org.apache.log4j.helpers.LogLog.
+        Log4j 1.2 bridge adds org.apache.log4j.helpers.LogLog.
       </action>
     </release>
     <release version="2.17.1" date="2021-MM-DD" description="GA Release 2.17.1">