[jira] [Commented] (LOG4NET-602) Log4Net missing messages

2018-07-09 Thread Dominik Psenner (JIRA)


[ 
https://issues.apache.org/jira/browse/LOG4NET-602?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16538099#comment-16538099
 ] 

Dominik Psenner commented on LOG4NET-602:
-

(Pong)

Yes, there is.

Hi Juan Gonzalez. Unfortunately there's at the moment nothing that I could do 
for you. Until now I've not crossed a similar situation so far. There are many 
spinning wheels and it's not clear what's going on. This indicates that this 
issue requires a significant amount of investigation to even get a clue. Such 
an investigation well exceeds the resources that I donate to the project from 
the little spare time I have available. Unfortunately, what this means to you 
is that you have to investigate this issue by yourself. Providing us with a 
minimal project or a test case that reproduces the issue we can address any 
potential issue if there is one. I'm looking forward to hear what you find out.

Good luck!

> Log4Net missing messages
> 
>
> Key: LOG4NET-602
> URL: https://issues.apache.org/jira/browse/LOG4NET-602
> Project: Log4net
>  Issue Type: Bug
>  Components: Appenders
>Affects Versions: 2.0.8
>Reporter: Juan Gonzalez
>Priority: Blocker
> Attachments: log4net.config, log4net.zip
>
>
> I am using log4net 2.0.8 from a C# service. This service has a method that 
> writes out a status message of application domains that it has loaded on a 
> timer (normally every three minutes, but set to 30 seconds for testing). What 
> I have found is that some of our status messages are missing. It appeared to 
> me from the message, that the code is working, but no message is being 
> generated.
> So, I added a Debug.WriteLine before every Log.Fatal (set to Fatal for 
> testing) and ran the code.
> As you can see from the attached log4net.txt, the code logged successfully 
> and then failed.
> The output should have the following messages.
> tmrLogData_Elapsed
> LogData, Enter
> LogData, appDomainUtilsLoggingList.Count
> LogData, 1
> LogData, 2
> LogData, 3
> LogData, 4
> LogData, sb.Count
> LogData - start, logDataCounter
> LogData, 5
> LogData, Exit
>  You see the run that failed on lines 302786 - 302810.  It has the 
> Debug.WriteLine calls, but only some of the Log.Fatal calls logged anything.
> We are very concerned that log4net may be missing other critical messages.
> Please feel free to reach out to me if you need further information.
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (LOG4J2-2368) Outputs wrong message when used within overridden Throwable method

2018-07-09 Thread Taisuke Tashiro (JIRA)


[ 
https://issues.apache.org/jira/browse/LOG4J2-2368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16538081#comment-16538081
 ] 

Taisuke Tashiro commented on LOG4J2-2368:
-

Verified that it works properly now. Thanks.

> Outputs wrong message when used within overridden Throwable method
> --
>
> Key: LOG4J2-2368
> URL: https://issues.apache.org/jira/browse/LOG4J2-2368
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.8.1, 2.11.0
>Reporter: Taisuke Tashiro
>Assignee: Carter Kozak
>Priority: Major
> Fix For: 3.0.0, 2.11.1
>
>
> When a message A is logged with Throwable object and if message B is logged 
> within the Throwable object's method, message A is lost and message B is 
> logged instead.
> Following is a code example to recreate the issue:
> {{Logger loggerA = LogManager.getLogger("A");}}
> {{Logger loggerB = LogManager.getLogger("B");}}
> {{Throwable throwable =}}
> {{    new Throwable() {}}
> {{    public String getMessage() {}}
> {{    loggerB.debug("MESSAGE B");}}
> {{    return "message";}}
> {{    }}}
> {{    };}}
> {{loggerA.debug("MESSEGE A", throwable);}}
> "MESSAGE A" should be logged to loggerA but "MESSAGE B" is logged instead.
> Cause of this problem is reuse of StringBuilder instance within the execution 
> thread in org.apache.logging.log4j.core.layout.AbstractStringLayout class. 
> While processing loggerA, getMessage() is called by 
> org.apache.logging.log4j.core.impl.ThrowableProxy to obtain throwable object 
> information and the content of StringBuilder is changed by loggerB.
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (LOG4J2-2368) Outputs wrong message when used within overridden Throwable method

2018-07-09 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/LOG4J2-2368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16537970#comment-16537970
 ] 

ASF GitHub Bot commented on LOG4J2-2368:


Github user remkop commented on a diff in the pull request:

https://github.com/apache/logging-log4j2/pull/189#discussion_r201213575
  
--- Diff: 
log4j-core/src/main/java/org/apache/logging/log4j/core/layout/AbstractStringLayout.java
 ---
@@ -114,6 +115,10 @@ public B setHeaderSerializer(final Serializer 
headerSerializer) {
  * @return a {@code StringBuilder}
  */
 protected static StringBuilder getStringBuilder() {
+if (AbstractLogger.getRecursionDepth() > 1) { // LOG4J2-2368
--- End diff --

`AbstractLogger.recursionDepthHolder` is of type `ThreadLocal` 
because that was the simplest data structure that met all the requirements:
* It needs to be thread-local, because when multiple threads are logging 
concurrently each thread has its own recursion depth
* Incrementing and decrementing the counter happens at least once for each 
log message so should be fast and not allocate any objects

An alternative would have been to use `ThreadLocal`. This 
would allow the `AbstractLogger` code to look like 
`getRecursionDepthHolder().incrementAndGet()` instead of 
`getRecursionDepthHolder()[0]++`. 

That's perhaps a bit nicer, but I thought it looked strange to hold a 
thread-safe atomic data structure inside a thread-local. `ThreadLocal` 
felt simpler.


> Outputs wrong message when used within overridden Throwable method
> --
>
> Key: LOG4J2-2368
> URL: https://issues.apache.org/jira/browse/LOG4J2-2368
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.8.1, 2.11.0
>Reporter: Taisuke Tashiro
>Assignee: Carter Kozak
>Priority: Major
> Fix For: 3.0.0, 2.11.1
>
>
> When a message A is logged with Throwable object and if message B is logged 
> within the Throwable object's method, message A is lost and message B is 
> logged instead.
> Following is a code example to recreate the issue:
> {{Logger loggerA = LogManager.getLogger("A");}}
> {{Logger loggerB = LogManager.getLogger("B");}}
> {{Throwable throwable =}}
> {{    new Throwable() {}}
> {{    public String getMessage() {}}
> {{    loggerB.debug("MESSAGE B");}}
> {{    return "message";}}
> {{    }}}
> {{    };}}
> {{loggerA.debug("MESSEGE A", throwable);}}
> "MESSAGE A" should be logged to loggerA but "MESSAGE B" is logged instead.
> Cause of this problem is reuse of StringBuilder instance within the execution 
> thread in org.apache.logging.log4j.core.layout.AbstractStringLayout class. 
> While processing loggerA, getMessage() is called by 
> org.apache.logging.log4j.core.impl.ThrowableProxy to obtain throwable object 
> information and the content of StringBuilder is changed by loggerB.
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[GitHub] logging-log4j2 pull request #189: [LOG4J2-2368] Recursive logging doesn't cl...

2018-07-09 Thread remkop
Github user remkop commented on a diff in the pull request:

https://github.com/apache/logging-log4j2/pull/189#discussion_r201213575
  
--- Diff: 
log4j-core/src/main/java/org/apache/logging/log4j/core/layout/AbstractStringLayout.java
 ---
@@ -114,6 +115,10 @@ public B setHeaderSerializer(final Serializer 
headerSerializer) {
  * @return a {@code StringBuilder}
  */
 protected static StringBuilder getStringBuilder() {
+if (AbstractLogger.getRecursionDepth() > 1) { // LOG4J2-2368
--- End diff --

`AbstractLogger.recursionDepthHolder` is of type `ThreadLocal` 
because that was the simplest data structure that met all the requirements:
* It needs to be thread-local, because when multiple threads are logging 
concurrently each thread has its own recursion depth
* Incrementing and decrementing the counter happens at least once for each 
log message so should be fast and not allocate any objects

An alternative would have been to use `ThreadLocal`. This 
would allow the `AbstractLogger` code to look like 
`getRecursionDepthHolder().incrementAndGet()` instead of 
`getRecursionDepthHolder()[0]++`. 

That's perhaps a bit nicer, but I thought it looked strange to hold a 
thread-safe atomic data structure inside a thread-local. `ThreadLocal` 
felt simpler.


---


[jira] [Commented] (LOG4J2-2368) Outputs wrong message when used within overridden Throwable method

2018-07-09 Thread Carter Kozak (JIRA)


[ 
https://issues.apache.org/jira/browse/LOG4J2-2368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16537841#comment-16537841
 ] 

Carter Kozak commented on LOG4J2-2368:
--

[~Tai Tash] Would you mind verifying against a snapshot?

> Outputs wrong message when used within overridden Throwable method
> --
>
> Key: LOG4J2-2368
> URL: https://issues.apache.org/jira/browse/LOG4J2-2368
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.8.1, 2.11.0
>Reporter: Taisuke Tashiro
>Assignee: Carter Kozak
>Priority: Major
> Fix For: 3.0.0, 2.11.1
>
>
> When a message A is logged with Throwable object and if message B is logged 
> within the Throwable object's method, message A is lost and message B is 
> logged instead.
> Following is a code example to recreate the issue:
> {{Logger loggerA = LogManager.getLogger("A");}}
> {{Logger loggerB = LogManager.getLogger("B");}}
> {{Throwable throwable =}}
> {{    new Throwable() {}}
> {{    public String getMessage() {}}
> {{    loggerB.debug("MESSAGE B");}}
> {{    return "message";}}
> {{    }}}
> {{    };}}
> {{loggerA.debug("MESSEGE A", throwable);}}
> "MESSAGE A" should be logged to loggerA but "MESSAGE B" is logged instead.
> Cause of this problem is reuse of StringBuilder instance within the execution 
> thread in org.apache.logging.log4j.core.layout.AbstractStringLayout class. 
> While processing loggerA, getMessage() is called by 
> org.apache.logging.log4j.core.impl.ThrowableProxy to obtain throwable object 
> information and the content of StringBuilder is changed by loggerB.
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Updated] (LOG4J2-2368) Outputs wrong message when used within overridden Throwable method

2018-07-09 Thread Carter Kozak (JIRA)


 [ 
https://issues.apache.org/jira/browse/LOG4J2-2368?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Carter Kozak updated LOG4J2-2368:
-
Fix Version/s: 2.11.1
   3.0.0

> Outputs wrong message when used within overridden Throwable method
> --
>
> Key: LOG4J2-2368
> URL: https://issues.apache.org/jira/browse/LOG4J2-2368
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.8.1, 2.11.0
>Reporter: Taisuke Tashiro
>Assignee: Carter Kozak
>Priority: Major
> Fix For: 3.0.0, 2.11.1
>
>
> When a message A is logged with Throwable object and if message B is logged 
> within the Throwable object's method, message A is lost and message B is 
> logged instead.
> Following is a code example to recreate the issue:
> {{Logger loggerA = LogManager.getLogger("A");}}
> {{Logger loggerB = LogManager.getLogger("B");}}
> {{Throwable throwable =}}
> {{    new Throwable() {}}
> {{    public String getMessage() {}}
> {{    loggerB.debug("MESSAGE B");}}
> {{    return "message";}}
> {{    }}}
> {{    };}}
> {{loggerA.debug("MESSEGE A", throwable);}}
> "MESSAGE A" should be logged to loggerA but "MESSAGE B" is logged instead.
> Cause of this problem is reuse of StringBuilder instance within the execution 
> thread in org.apache.logging.log4j.core.layout.AbstractStringLayout class. 
> While processing loggerA, getMessage() is called by 
> org.apache.logging.log4j.core.impl.ThrowableProxy to obtain throwable object 
> information and the content of StringBuilder is changed by loggerB.
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Resolved] (LOG4J2-2368) Outputs wrong message when used within overridden Throwable method

2018-07-09 Thread Carter Kozak (JIRA)


 [ 
https://issues.apache.org/jira/browse/LOG4J2-2368?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Carter Kozak resolved LOG4J2-2368.
--
Resolution: Fixed

> Outputs wrong message when used within overridden Throwable method
> --
>
> Key: LOG4J2-2368
> URL: https://issues.apache.org/jira/browse/LOG4J2-2368
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.8.1, 2.11.0
>Reporter: Taisuke Tashiro
>Assignee: Carter Kozak
>Priority: Major
> Fix For: 3.0.0, 2.11.1
>
>
> When a message A is logged with Throwable object and if message B is logged 
> within the Throwable object's method, message A is lost and message B is 
> logged instead.
> Following is a code example to recreate the issue:
> {{Logger loggerA = LogManager.getLogger("A");}}
> {{Logger loggerB = LogManager.getLogger("B");}}
> {{Throwable throwable =}}
> {{    new Throwable() {}}
> {{    public String getMessage() {}}
> {{    loggerB.debug("MESSAGE B");}}
> {{    return "message";}}
> {{    }}}
> {{    };}}
> {{loggerA.debug("MESSEGE A", throwable);}}
> "MESSAGE A" should be logged to loggerA but "MESSAGE B" is logged instead.
> Cause of this problem is reuse of StringBuilder instance within the execution 
> thread in org.apache.logging.log4j.core.layout.AbstractStringLayout class. 
> While processing loggerA, getMessage() is called by 
> org.apache.logging.log4j.core.impl.ThrowableProxy to obtain throwable object 
> information and the content of StringBuilder is changed by loggerB.
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (LOG4J2-2368) Outputs wrong message when used within overridden Throwable method

2018-07-09 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/LOG4J2-2368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16537829#comment-16537829
 ] 

ASF GitHub Bot commented on LOG4J2-2368:


Github user asfgit closed the pull request at:

https://github.com/apache/logging-log4j2/pull/189


> Outputs wrong message when used within overridden Throwable method
> --
>
> Key: LOG4J2-2368
> URL: https://issues.apache.org/jira/browse/LOG4J2-2368
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.8.1, 2.11.0
>Reporter: Taisuke Tashiro
>Assignee: Carter Kozak
>Priority: Major
>
> When a message A is logged with Throwable object and if message B is logged 
> within the Throwable object's method, message A is lost and message B is 
> logged instead.
> Following is a code example to recreate the issue:
> {{Logger loggerA = LogManager.getLogger("A");}}
> {{Logger loggerB = LogManager.getLogger("B");}}
> {{Throwable throwable =}}
> {{    new Throwable() {}}
> {{    public String getMessage() {}}
> {{    loggerB.debug("MESSAGE B");}}
> {{    return "message";}}
> {{    }}}
> {{    };}}
> {{loggerA.debug("MESSEGE A", throwable);}}
> "MESSAGE A" should be logged to loggerA but "MESSAGE B" is logged instead.
> Cause of this problem is reuse of StringBuilder instance within the execution 
> thread in org.apache.logging.log4j.core.layout.AbstractStringLayout class. 
> While processing loggerA, getMessage() is called by 
> org.apache.logging.log4j.core.impl.ThrowableProxy to obtain throwable object 
> information and the content of StringBuilder is changed by loggerB.
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[GitHub] logging-log4j2 pull request #189: [LOG4J2-2368] Recursive logging doesn't cl...

2018-07-09 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/logging-log4j2/pull/189


---


[jira] [Commented] (LOG4J2-2368) Outputs wrong message when used within overridden Throwable method

2018-07-09 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/LOG4J2-2368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16537827#comment-16537827
 ] 

ASF subversion and git services commented on LOG4J2-2368:
-

Commit 52929d579263e26295ae92d6f587c82a883a814d in logging-log4j2's branch 
refs/heads/release-2.x from [~ckozak]
[ https://git-wip-us.apache.org/repos/asf?p=logging-log4j2.git;h=52929d5 ]

[LOG4J2-2368] Recursive logging doesn't clobber cached StringBuidlers

This closes #189


> Outputs wrong message when used within overridden Throwable method
> --
>
> Key: LOG4J2-2368
> URL: https://issues.apache.org/jira/browse/LOG4J2-2368
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.8.1, 2.11.0
>Reporter: Taisuke Tashiro
>Assignee: Carter Kozak
>Priority: Major
>
> When a message A is logged with Throwable object and if message B is logged 
> within the Throwable object's method, message A is lost and message B is 
> logged instead.
> Following is a code example to recreate the issue:
> {{Logger loggerA = LogManager.getLogger("A");}}
> {{Logger loggerB = LogManager.getLogger("B");}}
> {{Throwable throwable =}}
> {{    new Throwable() {}}
> {{    public String getMessage() {}}
> {{    loggerB.debug("MESSAGE B");}}
> {{    return "message";}}
> {{    }}}
> {{    };}}
> {{loggerA.debug("MESSEGE A", throwable);}}
> "MESSAGE A" should be logged to loggerA but "MESSAGE B" is logged instead.
> Cause of this problem is reuse of StringBuilder instance within the execution 
> thread in org.apache.logging.log4j.core.layout.AbstractStringLayout class. 
> While processing loggerA, getMessage() is called by 
> org.apache.logging.log4j.core.impl.ThrowableProxy to obtain throwable object 
> information and the content of StringBuilder is changed by loggerB.
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (LOG4J2-2368) Outputs wrong message when used within overridden Throwable method

2018-07-09 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/LOG4J2-2368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16537828#comment-16537828
 ] 

ASF subversion and git services commented on LOG4J2-2368:
-

Commit 38e59a1191b8d50af416e0428addeabcfc145d61 in logging-log4j2's branch 
refs/heads/master from [~ckozak]
[ https://git-wip-us.apache.org/repos/asf?p=logging-log4j2.git;h=38e59a1 ]

[LOG4J2-2368] Recursive logging doesn't clobber cached StringBuidlers

This closes #189


> Outputs wrong message when used within overridden Throwable method
> --
>
> Key: LOG4J2-2368
> URL: https://issues.apache.org/jira/browse/LOG4J2-2368
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.8.1, 2.11.0
>Reporter: Taisuke Tashiro
>Assignee: Carter Kozak
>Priority: Major
>
> When a message A is logged with Throwable object and if message B is logged 
> within the Throwable object's method, message A is lost and message B is 
> logged instead.
> Following is a code example to recreate the issue:
> {{Logger loggerA = LogManager.getLogger("A");}}
> {{Logger loggerB = LogManager.getLogger("B");}}
> {{Throwable throwable =}}
> {{    new Throwable() {}}
> {{    public String getMessage() {}}
> {{    loggerB.debug("MESSAGE B");}}
> {{    return "message";}}
> {{    }}}
> {{    };}}
> {{loggerA.debug("MESSEGE A", throwable);}}
> "MESSAGE A" should be logged to loggerA but "MESSAGE B" is logged instead.
> Cause of this problem is reuse of StringBuilder instance within the execution 
> thread in org.apache.logging.log4j.core.layout.AbstractStringLayout class. 
> While processing loggerA, getMessage() is called by 
> org.apache.logging.log4j.core.impl.ThrowableProxy to obtain throwable object 
> information and the content of StringBuilder is changed by loggerB.
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (LOG4J2-2368) Outputs wrong message when used within overridden Throwable method

2018-07-09 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/LOG4J2-2368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16537814#comment-16537814
 ] 

ASF GitHub Bot commented on LOG4J2-2368:


Github user cakofony commented on a diff in the pull request:

https://github.com/apache/logging-log4j2/pull/189#discussion_r201183751
  
--- Diff: 
log4j-core/src/main/java/org/apache/logging/log4j/core/layout/AbstractStringLayout.java
 ---
@@ -114,6 +115,10 @@ public B setHeaderSerializer(final Serializer 
headerSerializer) {
  * @return a {@code StringBuilder}
  */
 protected static StringBuilder getStringBuilder() {
+if (AbstractLogger.getRecursionDepth() > 1) { // LOG4J2-2368
--- End diff --

My guess is Integer would require boxing/unboxing on set/access and 
AtomicInteger incurs a cost for thread safety. The array is a cheap MutableInt. 
@remkop could likely provide a definitive answer.


> Outputs wrong message when used within overridden Throwable method
> --
>
> Key: LOG4J2-2368
> URL: https://issues.apache.org/jira/browse/LOG4J2-2368
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.8.1, 2.11.0
>Reporter: Taisuke Tashiro
>Assignee: Carter Kozak
>Priority: Major
>
> When a message A is logged with Throwable object and if message B is logged 
> within the Throwable object's method, message A is lost and message B is 
> logged instead.
> Following is a code example to recreate the issue:
> {{Logger loggerA = LogManager.getLogger("A");}}
> {{Logger loggerB = LogManager.getLogger("B");}}
> {{Throwable throwable =}}
> {{    new Throwable() {}}
> {{    public String getMessage() {}}
> {{    loggerB.debug("MESSAGE B");}}
> {{    return "message";}}
> {{    }}}
> {{    };}}
> {{loggerA.debug("MESSEGE A", throwable);}}
> "MESSAGE A" should be logged to loggerA but "MESSAGE B" is logged instead.
> Cause of this problem is reuse of StringBuilder instance within the execution 
> thread in org.apache.logging.log4j.core.layout.AbstractStringLayout class. 
> While processing loggerA, getMessage() is called by 
> org.apache.logging.log4j.core.impl.ThrowableProxy to obtain throwable object 
> information and the content of StringBuilder is changed by loggerB.
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[GitHub] logging-log4j2 pull request #189: [LOG4J2-2368] Recursive logging doesn't cl...

2018-07-09 Thread cakofony
Github user cakofony commented on a diff in the pull request:

https://github.com/apache/logging-log4j2/pull/189#discussion_r201183751
  
--- Diff: 
log4j-core/src/main/java/org/apache/logging/log4j/core/layout/AbstractStringLayout.java
 ---
@@ -114,6 +115,10 @@ public B setHeaderSerializer(final Serializer 
headerSerializer) {
  * @return a {@code StringBuilder}
  */
 protected static StringBuilder getStringBuilder() {
+if (AbstractLogger.getRecursionDepth() > 1) { // LOG4J2-2368
--- End diff --

My guess is Integer would require boxing/unboxing on set/access and 
AtomicInteger incurs a cost for thread safety. The array is a cheap MutableInt. 
@remkop could likely provide a definitive answer.


---


[jira] [Commented] (LOG4J2-2368) Outputs wrong message when used within overridden Throwable method

2018-07-09 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/LOG4J2-2368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16537766#comment-16537766
 ] 

ASF GitHub Bot commented on LOG4J2-2368:


Github user garydgregory commented on a diff in the pull request:

https://github.com/apache/logging-log4j2/pull/189#discussion_r201176090
  
--- Diff: 
log4j-core/src/main/java/org/apache/logging/log4j/core/layout/AbstractStringLayout.java
 ---
@@ -114,6 +115,10 @@ public B setHeaderSerializer(final Serializer 
headerSerializer) {
  * @return a {@code StringBuilder}
  */
 protected static StringBuilder getStringBuilder() {
+if (AbstractLogger.getRecursionDepth() > 1) { // LOG4J2-2368
--- End diff --

Curious and somewhat unrelated: Why isn't the recursion depth a Integer or 
AtomicInteger?


> Outputs wrong message when used within overridden Throwable method
> --
>
> Key: LOG4J2-2368
> URL: https://issues.apache.org/jira/browse/LOG4J2-2368
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.8.1, 2.11.0
>Reporter: Taisuke Tashiro
>Assignee: Carter Kozak
>Priority: Major
>
> When a message A is logged with Throwable object and if message B is logged 
> within the Throwable object's method, message A is lost and message B is 
> logged instead.
> Following is a code example to recreate the issue:
> {{Logger loggerA = LogManager.getLogger("A");}}
> {{Logger loggerB = LogManager.getLogger("B");}}
> {{Throwable throwable =}}
> {{    new Throwable() {}}
> {{    public String getMessage() {}}
> {{    loggerB.debug("MESSAGE B");}}
> {{    return "message";}}
> {{    }}}
> {{    };}}
> {{loggerA.debug("MESSEGE A", throwable);}}
> "MESSAGE A" should be logged to loggerA but "MESSAGE B" is logged instead.
> Cause of this problem is reuse of StringBuilder instance within the execution 
> thread in org.apache.logging.log4j.core.layout.AbstractStringLayout class. 
> While processing loggerA, getMessage() is called by 
> org.apache.logging.log4j.core.impl.ThrowableProxy to obtain throwable object 
> information and the content of StringBuilder is changed by loggerB.
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[GitHub] logging-log4j2 pull request #189: [LOG4J2-2368] Recursive logging doesn't cl...

2018-07-09 Thread garydgregory
Github user garydgregory commented on a diff in the pull request:

https://github.com/apache/logging-log4j2/pull/189#discussion_r201176090
  
--- Diff: 
log4j-core/src/main/java/org/apache/logging/log4j/core/layout/AbstractStringLayout.java
 ---
@@ -114,6 +115,10 @@ public B setHeaderSerializer(final Serializer 
headerSerializer) {
  * @return a {@code StringBuilder}
  */
 protected static StringBuilder getStringBuilder() {
+if (AbstractLogger.getRecursionDepth() > 1) { // LOG4J2-2368
--- End diff --

Curious and somewhat unrelated: Why isn't the recursion depth a Integer or 
AtomicInteger?


---


[jira] [Assigned] (LOG4J2-2368) Outputs wrong message when used within overridden Throwable method

2018-07-09 Thread Carter Kozak (JIRA)


 [ 
https://issues.apache.org/jira/browse/LOG4J2-2368?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Carter Kozak reassigned LOG4J2-2368:


Assignee: Carter Kozak

> Outputs wrong message when used within overridden Throwable method
> --
>
> Key: LOG4J2-2368
> URL: https://issues.apache.org/jira/browse/LOG4J2-2368
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.8.1, 2.11.0
>Reporter: Taisuke Tashiro
>Assignee: Carter Kozak
>Priority: Major
>
> When a message A is logged with Throwable object and if message B is logged 
> within the Throwable object's method, message A is lost and message B is 
> logged instead.
> Following is a code example to recreate the issue:
> {{Logger loggerA = LogManager.getLogger("A");}}
> {{Logger loggerB = LogManager.getLogger("B");}}
> {{Throwable throwable =}}
> {{    new Throwable() {}}
> {{    public String getMessage() {}}
> {{    loggerB.debug("MESSAGE B");}}
> {{    return "message";}}
> {{    }}}
> {{    };}}
> {{loggerA.debug("MESSEGE A", throwable);}}
> "MESSAGE A" should be logged to loggerA but "MESSAGE B" is logged instead.
> Cause of this problem is reuse of StringBuilder instance within the execution 
> thread in org.apache.logging.log4j.core.layout.AbstractStringLayout class. 
> While processing loggerA, getMessage() is called by 
> org.apache.logging.log4j.core.impl.ThrowableProxy to obtain throwable object 
> information and the content of StringBuilder is changed by loggerB.
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (LOG4J2-2368) Outputs wrong message when used within overridden Throwable method

2018-07-09 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/LOG4J2-2368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16537727#comment-16537727
 ] 

ASF GitHub Bot commented on LOG4J2-2368:


GitHub user cakofony opened a pull request:

https://github.com/apache/logging-log4j2/pull/189

[LOG4J2-2368] Recursive logging doesn't clobber cached StringBuidlers



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/cakofony/logging-log4j2 LOG4J2-2368

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/logging-log4j2/pull/189.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #189


commit c213024d33ed2c95ece9fb788ee5fd0e62d0bc5a
Author: Carter Kozak 
Date:   2018-07-09T21:13:20Z

[LOG4J2-2368] Recursive logging doesn't clobber cached StringBuidlers




> Outputs wrong message when used within overridden Throwable method
> --
>
> Key: LOG4J2-2368
> URL: https://issues.apache.org/jira/browse/LOG4J2-2368
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.8.1, 2.11.0
>Reporter: Taisuke Tashiro
>Priority: Major
>
> When a message A is logged with Throwable object and if message B is logged 
> within the Throwable object's method, message A is lost and message B is 
> logged instead.
> Following is a code example to recreate the issue:
> {{Logger loggerA = LogManager.getLogger("A");}}
> {{Logger loggerB = LogManager.getLogger("B");}}
> {{Throwable throwable =}}
> {{    new Throwable() {}}
> {{    public String getMessage() {}}
> {{    loggerB.debug("MESSAGE B");}}
> {{    return "message";}}
> {{    }}}
> {{    };}}
> {{loggerA.debug("MESSEGE A", throwable);}}
> "MESSAGE A" should be logged to loggerA but "MESSAGE B" is logged instead.
> Cause of this problem is reuse of StringBuilder instance within the execution 
> thread in org.apache.logging.log4j.core.layout.AbstractStringLayout class. 
> While processing loggerA, getMessage() is called by 
> org.apache.logging.log4j.core.impl.ThrowableProxy to obtain throwable object 
> information and the content of StringBuilder is changed by loggerB.
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[GitHub] logging-log4j2 pull request #189: [LOG4J2-2368] Recursive logging doesn't cl...

2018-07-09 Thread cakofony
GitHub user cakofony opened a pull request:

https://github.com/apache/logging-log4j2/pull/189

[LOG4J2-2368] Recursive logging doesn't clobber cached StringBuidlers



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/cakofony/logging-log4j2 LOG4J2-2368

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/logging-log4j2/pull/189.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #189


commit c213024d33ed2c95ece9fb788ee5fd0e62d0bc5a
Author: Carter Kozak 
Date:   2018-07-09T21:13:20Z

[LOG4J2-2368] Recursive logging doesn't clobber cached StringBuidlers




---


[jira] [Commented] (LOG4NET-602) Log4Net missing messages

2018-07-09 Thread Juan Gonzalez (JIRA)


[ 
https://issues.apache.org/jira/browse/LOG4NET-602?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16536980#comment-16536980
 ] 

Juan Gonzalez commented on LOG4NET-602:
---

Is there anyone monitoring these issues?

> Log4Net missing messages
> 
>
> Key: LOG4NET-602
> URL: https://issues.apache.org/jira/browse/LOG4NET-602
> Project: Log4net
>  Issue Type: Bug
>  Components: Appenders
>Affects Versions: 2.0.8
>Reporter: Juan Gonzalez
>Priority: Blocker
> Attachments: log4net.config, log4net.zip
>
>
> I am using log4net 2.0.8 from a C# service. This service has a method that 
> writes out a status message of application domains that it has loaded on a 
> timer (normally every three minutes, but set to 30 seconds for testing). What 
> I have found is that some of our status messages are missing. It appeared to 
> me from the message, that the code is working, but no message is being 
> generated.
> So, I added a Debug.WriteLine before every Log.Fatal (set to Fatal for 
> testing) and ran the code.
> As you can see from the attached log4net.txt, the code logged successfully 
> and then failed.
> The output should have the following messages.
> tmrLogData_Elapsed
> LogData, Enter
> LogData, appDomainUtilsLoggingList.Count
> LogData, 1
> LogData, 2
> LogData, 3
> LogData, 4
> LogData, sb.Count
> LogData - start, logDataCounter
> LogData, 5
> LogData, Exit
>  You see the run that failed on lines 302786 - 302810.  It has the 
> Debug.WriteLine calls, but only some of the Log.Fatal calls logged anything.
> We are very concerned that log4net may be missing other critical messages.
> Please feel free to reach out to me if you need further information.
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)