You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rp...@apache.org on 2016/06/13 13:43:18 UTC

logging-log4j2 git commit: LOG4J2-1419 added system properties switch to enable locating where new LoggerContext is started

Repository: logging-log4j2
Updated Branches:
  refs/heads/master 6f7172c63 -> d1c907261


LOG4J2-1419 added system properties switch to enable locating where new LoggerContext is started


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

Branch: refs/heads/master
Commit: d1c907261127c69ef7ccda05cc8eb81e4b393528
Parents: 6f7172c
Author: rpopma <rp...@apache.org>
Authored: Mon Jun 13 22:43:13 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Mon Jun 13 22:43:13 2016 +0900

----------------------------------------------------------------------
 .../main/java/org/apache/logging/log4j/core/LoggerContext.java  | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d1c90726/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
index fea1975..578a781 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
@@ -45,6 +45,7 @@ import org.apache.logging.log4j.spi.AbstractLogger;
 import org.apache.logging.log4j.spi.LoggerContextFactory;
 import org.apache.logging.log4j.spi.LoggerRegistry;
 import org.apache.logging.log4j.spi.Terminable;
+import org.apache.logging.log4j.util.PropertiesUtil;
 
 import static org.apache.logging.log4j.core.util.ShutdownCallbackRegistry.*;
 
@@ -205,6 +206,10 @@ public class LoggerContext extends AbstractLifeCycle implements org.apache.loggi
     @Override
     public void start() {
         LOGGER.debug("Starting LoggerContext[name={}, {}]...", getName(), this);
+        if (PropertiesUtil.getProperties().getBooleanProperty("log4j.LoggerContext.trace.start", false)) {
+            LOGGER.debug("Stack trace to locate invoker",
+                    new Exception("Not a real error, showing stack trace to locate invoker"));
+        }
         if (configLock.tryLock()) {
             try {
                 if (this.isInitialized() || this.isStopped()) {


Re: logging-log4j2 git commit: LOG4J2-1419 added system properties switch to enable locating where new LoggerContext is started

Posted by Remko Popma <re...@gmail.com>.
You're right. I changed the name to log4j.LoggerContext.stacktrace.on.start

On Tue, Jun 14, 2016 at 12:19 AM, Gary Gregory <ga...@gmail.com>
wrote:

> Who knows who might find this helpful. So maybe yeah, it should be
> documented anyway?
>
> Slightly confusing: the prop has trace in the name but the level is debug.
> I know we are logging a stack _trace_ of course... but it feel weird when I
> look at the patch.
>
> Gary
> On Jun 13, 2016 8:09 AM, "Remko Popma" <re...@gmail.com> wrote:
>
> Maybe I was being lazy :-) but this change is mostly targeted to
> fixing/investigating LOG4J2-1419. I don't imagine many people would need
> this. I could be wrong... We can add this to the list of documented system
> properties to configure Log4j if you think it is generally useful.
>
> On Mon, Jun 13, 2016 at 11:56 PM, Gary Gregory <ga...@gmail.com>
> wrote:
>
>> Shouldn't this be documented?
>>
>> Gary
>> ---------- Forwarded message ----------
>> From: <rp...@apache.org>
>> Date: Jun 13, 2016 6:43 AM
>> Subject: logging-log4j2 git commit: LOG4J2-1419 added system properties
>> switch to enable locating where new LoggerContext is started
>> To: <co...@logging.apache.org>
>> Cc:
>>
>> Repository: logging-log4j2
>> Updated Branches:
>>   refs/heads/master 6f7172c63 -> d1c907261
>>
>>
>> LOG4J2-1419 added system properties switch to enable locating where new
>> LoggerContext is started
>>
>>
>> Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
>> Commit:
>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/d1c90726
>> Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/d1c90726
>> Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/d1c90726
>>
>> Branch: refs/heads/master
>> Commit: d1c907261127c69ef7ccda05cc8eb81e4b393528
>> Parents: 6f7172c
>> Author: rpopma <rp...@apache.org>
>> Authored: Mon Jun 13 22:43:13 2016 +0900
>> Committer: rpopma <rp...@apache.org>
>> Committed: Mon Jun 13 22:43:13 2016 +0900
>>
>> ----------------------------------------------------------------------
>>  .../main/java/org/apache/logging/log4j/core/LoggerContext.java  | 5 +++++
>>  1 file changed, 5 insertions(+)
>> ----------------------------------------------------------------------
>>
>>
>>
>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d1c90726/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
>> ----------------------------------------------------------------------
>> diff --git
>> a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
>> b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
>> index fea1975..578a781 100644
>> ---
>> a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
>> +++
>> b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
>> @@ -45,6 +45,7 @@ import org.apache.logging.log4j.spi.AbstractLogger;
>>  import org.apache.logging.log4j.spi.LoggerContextFactory;
>>  import org.apache.logging.log4j.spi.LoggerRegistry;
>>  import org.apache.logging.log4j.spi.Terminable;
>> +import org.apache.logging.log4j.util.PropertiesUtil;
>>
>>  import static
>> org.apache.logging.log4j.core.util.ShutdownCallbackRegistry.*;
>>
>> @@ -205,6 +206,10 @@ public class LoggerContext extends AbstractLifeCycle
>> implements org.apache.loggi
>>      @Override
>>      public void start() {
>>          LOGGER.debug("Starting LoggerContext[name={}, {}]...",
>> getName(), this);
>> +        if
>> (PropertiesUtil.getProperties().getBooleanProperty("log4j.LoggerContext.trace.start",
>> false)) {
>> +            LOGGER.debug("Stack trace to locate invoker",
>> +                    new Exception("Not a real error, showing stack trace
>> to locate invoker"));
>> +        }
>>          if (configLock.tryLock()) {
>>              try {
>>                  if (this.isInitialized() || this.isStopped()) {
>>
>>
>

Re: logging-log4j2 git commit: LOG4J2-1419 added system properties switch to enable locating where new LoggerContext is started

Posted by Gary Gregory <ga...@gmail.com>.
Who knows who might find this helpful. So maybe yeah, it should be
documented anyway?

Slightly confusing: the prop has trace in the name but the level is debug.
I know we are logging a stack _trace_ of course... but it feel weird when I
look at the patch.

Gary
On Jun 13, 2016 8:09 AM, "Remko Popma" <re...@gmail.com> wrote:

Maybe I was being lazy :-) but this change is mostly targeted to
fixing/investigating LOG4J2-1419. I don't imagine many people would need
this. I could be wrong... We can add this to the list of documented system
properties to configure Log4j if you think it is generally useful.

On Mon, Jun 13, 2016 at 11:56 PM, Gary Gregory <ga...@gmail.com>
wrote:

> Shouldn't this be documented?
>
> Gary
> ---------- Forwarded message ----------
> From: <rp...@apache.org>
> Date: Jun 13, 2016 6:43 AM
> Subject: logging-log4j2 git commit: LOG4J2-1419 added system properties
> switch to enable locating where new LoggerContext is started
> To: <co...@logging.apache.org>
> Cc:
>
> Repository: logging-log4j2
> Updated Branches:
>   refs/heads/master 6f7172c63 -> d1c907261
>
>
> LOG4J2-1419 added system properties switch to enable locating where new
> LoggerContext is started
>
>
> Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
> Commit:
> http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/d1c90726
> Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/d1c90726
> Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/d1c90726
>
> Branch: refs/heads/master
> Commit: d1c907261127c69ef7ccda05cc8eb81e4b393528
> Parents: 6f7172c
> Author: rpopma <rp...@apache.org>
> Authored: Mon Jun 13 22:43:13 2016 +0900
> Committer: rpopma <rp...@apache.org>
> Committed: Mon Jun 13 22:43:13 2016 +0900
>
> ----------------------------------------------------------------------
>  .../main/java/org/apache/logging/log4j/core/LoggerContext.java  | 5 +++++
>  1 file changed, 5 insertions(+)
> ----------------------------------------------------------------------
>
>
>
> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d1c90726/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
> ----------------------------------------------------------------------
> diff --git
> a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
> b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
> index fea1975..578a781 100644
> ---
> a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
> +++
> b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
> @@ -45,6 +45,7 @@ import org.apache.logging.log4j.spi.AbstractLogger;
>  import org.apache.logging.log4j.spi.LoggerContextFactory;
>  import org.apache.logging.log4j.spi.LoggerRegistry;
>  import org.apache.logging.log4j.spi.Terminable;
> +import org.apache.logging.log4j.util.PropertiesUtil;
>
>  import static
> org.apache.logging.log4j.core.util.ShutdownCallbackRegistry.*;
>
> @@ -205,6 +206,10 @@ public class LoggerContext extends AbstractLifeCycle
> implements org.apache.loggi
>      @Override
>      public void start() {
>          LOGGER.debug("Starting LoggerContext[name={}, {}]...", getName(),
> this);
> +        if
> (PropertiesUtil.getProperties().getBooleanProperty("log4j.LoggerContext.trace.start",
> false)) {
> +            LOGGER.debug("Stack trace to locate invoker",
> +                    new Exception("Not a real error, showing stack trace
> to locate invoker"));
> +        }
>          if (configLock.tryLock()) {
>              try {
>                  if (this.isInitialized() || this.isStopped()) {
>
>

Re: logging-log4j2 git commit: LOG4J2-1419 added system properties switch to enable locating where new LoggerContext is started

Posted by Remko Popma <re...@gmail.com>.
Maybe I was being lazy :-) but this change is mostly targeted to
fixing/investigating LOG4J2-1419. I don't imagine many people would need
this. I could be wrong... We can add this to the list of documented system
properties to configure Log4j if you think it is generally useful.

On Mon, Jun 13, 2016 at 11:56 PM, Gary Gregory <ga...@gmail.com>
wrote:

> Shouldn't this be documented?
>
> Gary
> ---------- Forwarded message ----------
> From: <rp...@apache.org>
> Date: Jun 13, 2016 6:43 AM
> Subject: logging-log4j2 git commit: LOG4J2-1419 added system properties
> switch to enable locating where new LoggerContext is started
> To: <co...@logging.apache.org>
> Cc:
>
> Repository: logging-log4j2
> Updated Branches:
>   refs/heads/master 6f7172c63 -> d1c907261
>
>
> LOG4J2-1419 added system properties switch to enable locating where new
> LoggerContext is started
>
>
> Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
> Commit:
> http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/d1c90726
> Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/d1c90726
> Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/d1c90726
>
> Branch: refs/heads/master
> Commit: d1c907261127c69ef7ccda05cc8eb81e4b393528
> Parents: 6f7172c
> Author: rpopma <rp...@apache.org>
> Authored: Mon Jun 13 22:43:13 2016 +0900
> Committer: rpopma <rp...@apache.org>
> Committed: Mon Jun 13 22:43:13 2016 +0900
>
> ----------------------------------------------------------------------
>  .../main/java/org/apache/logging/log4j/core/LoggerContext.java  | 5 +++++
>  1 file changed, 5 insertions(+)
> ----------------------------------------------------------------------
>
>
>
> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d1c90726/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
> ----------------------------------------------------------------------
> diff --git
> a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
> b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
> index fea1975..578a781 100644
> ---
> a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
> +++
> b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
> @@ -45,6 +45,7 @@ import org.apache.logging.log4j.spi.AbstractLogger;
>  import org.apache.logging.log4j.spi.LoggerContextFactory;
>  import org.apache.logging.log4j.spi.LoggerRegistry;
>  import org.apache.logging.log4j.spi.Terminable;
> +import org.apache.logging.log4j.util.PropertiesUtil;
>
>  import static
> org.apache.logging.log4j.core.util.ShutdownCallbackRegistry.*;
>
> @@ -205,6 +206,10 @@ public class LoggerContext extends AbstractLifeCycle
> implements org.apache.loggi
>      @Override
>      public void start() {
>          LOGGER.debug("Starting LoggerContext[name={}, {}]...", getName(),
> this);
> +        if
> (PropertiesUtil.getProperties().getBooleanProperty("log4j.LoggerContext.trace.start",
> false)) {
> +            LOGGER.debug("Stack trace to locate invoker",
> +                    new Exception("Not a real error, showing stack trace
> to locate invoker"));
> +        }
>          if (configLock.tryLock()) {
>              try {
>                  if (this.isInitialized() || this.isStopped()) {
>
>

Fwd: logging-log4j2 git commit: LOG4J2-1419 added system properties switch to enable locating where new LoggerContext is started

Posted by Gary Gregory <ga...@gmail.com>.
Shouldn't this be documented?

Gary
---------- Forwarded message ----------
From: <rp...@apache.org>
Date: Jun 13, 2016 6:43 AM
Subject: logging-log4j2 git commit: LOG4J2-1419 added system properties
switch to enable locating where new LoggerContext is started
To: <co...@logging.apache.org>
Cc:

Repository: logging-log4j2
Updated Branches:
  refs/heads/master 6f7172c63 -> d1c907261


LOG4J2-1419 added system properties switch to enable locating where new
LoggerContext is started


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

Branch: refs/heads/master
Commit: d1c907261127c69ef7ccda05cc8eb81e4b393528
Parents: 6f7172c
Author: rpopma <rp...@apache.org>
Authored: Mon Jun 13 22:43:13 2016 +0900
Committer: rpopma <rp...@apache.org>
Committed: Mon Jun 13 22:43:13 2016 +0900

----------------------------------------------------------------------
 .../main/java/org/apache/logging/log4j/core/LoggerContext.java  | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/d1c90726/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
----------------------------------------------------------------------
diff --git
a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
index fea1975..578a781 100644
---
a/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
+++
b/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
@@ -45,6 +45,7 @@ import org.apache.logging.log4j.spi.AbstractLogger;
 import org.apache.logging.log4j.spi.LoggerContextFactory;
 import org.apache.logging.log4j.spi.LoggerRegistry;
 import org.apache.logging.log4j.spi.Terminable;
+import org.apache.logging.log4j.util.PropertiesUtil;

 import static
org.apache.logging.log4j.core.util.ShutdownCallbackRegistry.*;

@@ -205,6 +206,10 @@ public class LoggerContext extends AbstractLifeCycle
implements org.apache.loggi
     @Override
     public void start() {
         LOGGER.debug("Starting LoggerContext[name={}, {}]...", getName(),
this);
+        if
(PropertiesUtil.getProperties().getBooleanProperty("log4j.LoggerContext.trace.start",
false)) {
+            LOGGER.debug("Stack trace to locate invoker",
+                    new Exception("Not a real error, showing stack trace
to locate invoker"));
+        }
         if (configLock.tryLock()) {
             try {
                 if (this.isInitialized() || this.isStopped()) {