[jira] [Commented] (LOG4J2-2564) Error using %K in pattern : MapPatternConverter cannot contain multiple static newInstance method

2019-06-22 Thread David Knapp (JIRA)


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

David Knapp commented on LOG4J2-2564:
-

Is there a timeline for a release that will include this fix?

> Error using %K in pattern : MapPatternConverter cannot contain multiple 
> static newInstance method
> -
>
> Key: LOG4J2-2564
> URL: https://issues.apache.org/jira/browse/LOG4J2-2564
> Project: Log4j 2
>  Issue Type: Bug
>Affects Versions: 2.11.2
>Reporter: Anthony Communier
>Assignee: Carter Kozak
>Priority: Blocker
> Fix For: 2.12.0
>
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> When using a %K in a pattern, the MapPatterConverter is used and there is an 
> error message :
> ERROR Class class org.apache.logging.log4j.core.pattern.MapPatternConverter 
> cannot contain multiple static newInstance methods
>  
> The control is done by 
> org.apache.logging.log4j.core.pattern.PatternParser.createConverter here :
> {{ _// Work around the regression bug in Class.getDeclaredMethods() in Oracle 
> Java in version > 1.6.0_17:_}}
> {{    _// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6815786_}}
> {{    _final Method[] methods = converterClass.getDeclaredMethods();_}}
> {{    _Method newInstanceMethod = null;_}}
> {{    _for (final Method method : methods) {_}}
> {{    _if (Modifier.isStatic(method.getModifiers()) && 
> method.getDeclaringClass().equals(converterClass)_}}
> {{    _&& method.getName().equals("newInstance")) {_}}
> {{    _if (newInstanceMethod == null) {_}}
> {{    _newInstanceMethod = method;_}}
> {{    _} else if 
> (method.getReturnType().equals(newInstanceMethod.getReturnType())) {_}}
> {{    _LOGGER.error("Class " + converterClass + " cannot 
> contain multiple static newInstance methods");_}}
> {{    _return null;_}}
> {{    _}_}}
> {{    _}_}}
> {{    _}_}}
>  
> The class org.apache.logging.log4j.core.pattern.MapPatternConverter contains 
> 2 *newInstances* message (teh second introduced in 2.11.2)
>  
>  _/**_
>  _* Obtains an instance of \{@link MapPatternConverter}._
>  _*_
>  _* @param options options, may be null or first element contains name of 
> property to format._
>  _* @return instance of \{@link MapPatternConverter}._
>  _*/_
>     _public static MapPatternConverter newInstance(final String[] options) {_
>     _return new MapPatternConverter(options, JAVA_UNQUOTED);_
>     _}_
> {color:#d04437}    _/**_{color}
> {color:#d04437} _* Obtain an instance of \{@link 
> MapPatternConverter}._{color}
> {color:#d04437} _*_{color}
> {color:#d04437} _* @param options options, may be null or first element 
> contains name of property to format._{color}
> {color:#d04437} _* @param format the format to use if no options are 
> given (i.e., options is null). Ignored if options is non-null._{color}
> {color:#d04437} _* @return instance of \{@link 
> MapPatternConverter}._{color}
> {color:#d04437} _* @since 2.11.2_{color}
> {color:#d04437} _*/_{color}
> {color:#d04437}    _public static MapPatternConverter newInstance(final 
> String[] options, final MapFormat format) {_{color}
> {color:#d04437}    _return new MapPatternConverter(options, 
> Objects.toString(format, JAVA_UNQUOTED));_{color}
> {color:#d04437}    _}_{color}
>  
>  



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


[jira] [Commented] (LOG4J2-2564) Error using %K in pattern : MapPatternConverter cannot contain multiple static newInstance method

2019-05-13 Thread David Knapp (JIRA)


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

David Knapp commented on LOG4J2-2564:
-

Any update on this? What is the desired fix? Remove a newinstance method? Or 
allow multiple?

> Error using %K in pattern : MapPatternConverter cannot contain multiple 
> static newInstance method
> -
>
> Key: LOG4J2-2564
> URL: https://issues.apache.org/jira/browse/LOG4J2-2564
> Project: Log4j 2
>  Issue Type: Bug
>Affects Versions: 2.11.2
>Reporter: Anthony Communier
>Priority: Blocker
>
> When using a %K in a pattern, the MapPatterConverter is used and there is an 
> error message :
> ERROR Class class org.apache.logging.log4j.core.pattern.MapPatternConverter 
> cannot contain multiple static newInstance methods
>  
> The control is done by 
> org.apache.logging.log4j.core.pattern.PatternParser.createConverter here :
> {{ _// Work around the regression bug in Class.getDeclaredMethods() in Oracle 
> Java in version > 1.6.0_17:_}}
> {{    _// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6815786_}}
> {{    _final Method[] methods = converterClass.getDeclaredMethods();_}}
> {{    _Method newInstanceMethod = null;_}}
> {{    _for (final Method method : methods) {_}}
> {{    _if (Modifier.isStatic(method.getModifiers()) && 
> method.getDeclaringClass().equals(converterClass)_}}
> {{    _&& method.getName().equals("newInstance")) {_}}
> {{    _if (newInstanceMethod == null) {_}}
> {{    _newInstanceMethod = method;_}}
> {{    _} else if 
> (method.getReturnType().equals(newInstanceMethod.getReturnType())) {_}}
> {{    _LOGGER.error("Class " + converterClass + " cannot 
> contain multiple static newInstance methods");_}}
> {{    _return null;_}}
> {{    _}_}}
> {{    _}_}}
> {{    _}_}}
>  
> The class org.apache.logging.log4j.core.pattern.MapPatternConverter contains 
> 2 *newInstances* message (teh second introduced in 2.11.2)
>  
>  _/**_
>  _* Obtains an instance of \{@link MapPatternConverter}._
>  _*_
>  _* @param options options, may be null or first element contains name of 
> property to format._
>  _* @return instance of \{@link MapPatternConverter}._
>  _*/_
>     _public static MapPatternConverter newInstance(final String[] options) {_
>     _return new MapPatternConverter(options, JAVA_UNQUOTED);_
>     _}_
> {color:#d04437}    _/**_{color}
> {color:#d04437} _* Obtain an instance of \{@link 
> MapPatternConverter}._{color}
> {color:#d04437} _*_{color}
> {color:#d04437} _* @param options options, may be null or first element 
> contains name of property to format._{color}
> {color:#d04437} _* @param format the format to use if no options are 
> given (i.e., options is null). Ignored if options is non-null._{color}
> {color:#d04437} _* @return instance of \{@link 
> MapPatternConverter}._{color}
> {color:#d04437} _* @since 2.11.2_{color}
> {color:#d04437} _*/_{color}
> {color:#d04437}    _public static MapPatternConverter newInstance(final 
> String[] options, final MapFormat format) {_{color}
> {color:#d04437}    _return new MapPatternConverter(options, 
> Objects.toString(format, JAVA_UNQUOTED));_{color}
> {color:#d04437}    _}_{color}
>  
>  



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


[jira] [Updated] (LOG4J2-2312) Using async appender with json layout causes only the message to be written

2018-04-08 Thread David Knapp (JIRA)

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

David Knapp updated LOG4J2-2312:

Description: 
When using the async appender combined with the JsonLayout, you only get the 
results of the message being written to the appender.

 

I took a look at it seems like this is because RingBufferLogEvent implements 
ReusableMessage which is where jackson gets the MessageSerializer, whereas the 
non async LogEvent doesn't, so it gets the BeanSerializer

Attached are traces, both of which originating from the 
MessageSerializer.serialize method

  was:
When using the async appender combined with the JsonLayout, you only get the 
results of the message being written to the appender.

 

I took a look at it seems like this is because RingBufferLogEvent implements 
ReusableMessage which is where jackson gets the MessageSerializer, whereas the 
non async LogEvent doesn't, so it gets the BeanSerializer


> Using async appender with json layout causes only the message to be written
> ---
>
> Key: LOG4J2-2312
> URL: https://issues.apache.org/jira/browse/LOG4J2-2312
> Project: Log4j 2
>  Issue Type: Bug
>Reporter: David Knapp
>Priority: Major
> Attachments: async_trace.txt, synchronous_trace.txt
>
>
> When using the async appender combined with the JsonLayout, you only get the 
> results of the message being written to the appender.
>  
> I took a look at it seems like this is because RingBufferLogEvent implements 
> ReusableMessage which is where jackson gets the MessageSerializer, whereas 
> the non async LogEvent doesn't, so it gets the BeanSerializer
> Attached are traces, both of which originating from the 
> MessageSerializer.serialize method



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


[jira] [Updated] (LOG4J2-2312) Using async appender with json layout causes only the message to be written

2018-04-08 Thread David Knapp (JIRA)

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

David Knapp updated LOG4J2-2312:

Description: 
When using the async appender combined with the JsonLayout, you only get the 
results of the message being written to the appender.
 
I took a look at it seems like this is because RingBufferLogEvent implements 
ReusableMessage which is where jackson gets the MessageSerializer, whereas the 
non async LogEvent doesn't, so it gets the BeanSerializer

Attached are traces, both of which originating from the 
MessageSerializer.serialize method

  was:
When using the async appender combined with the JsonLayout, you only get the 
results of the message being written to the appender.

 

I took a look at it seems like this is because RingBufferLogEvent implements 
ReusableMessage which is where jackson gets the MessageSerializer, whereas the 
non async LogEvent doesn't, so it gets the BeanSerializer

Attached are traces, both of which originating from the 
MessageSerializer.serialize method


> Using async appender with json layout causes only the message to be written
> ---
>
> Key: LOG4J2-2312
> URL: https://issues.apache.org/jira/browse/LOG4J2-2312
> Project: Log4j 2
>  Issue Type: Bug
>Reporter: David Knapp
>Priority: Major
> Attachments: async_trace.txt, synchronous_trace.txt
>
>
> When using the async appender combined with the JsonLayout, you only get the 
> results of the message being written to the appender.
>  
> I took a look at it seems like this is because RingBufferLogEvent implements 
> ReusableMessage which is where jackson gets the MessageSerializer, whereas 
> the non async LogEvent doesn't, so it gets the BeanSerializer
> Attached are traces, both of which originating from the 
> MessageSerializer.serialize method



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


[jira] [Updated] (LOG4J2-2312) Using async appender with json layout causes only the message to be written

2018-04-08 Thread David Knapp (JIRA)

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

David Knapp updated LOG4J2-2312:

Attachment: async_trace.txt

> Using async appender with json layout causes only the message to be written
> ---
>
> Key: LOG4J2-2312
> URL: https://issues.apache.org/jira/browse/LOG4J2-2312
> Project: Log4j 2
>  Issue Type: Bug
>Reporter: David Knapp
>Priority: Major
> Attachments: async_trace.txt, synchronous_trace.txt
>
>
> When using the async appender combined with the JsonLayout, you only get the 
> results of the message being written to the appender.
>  
> I took a look at it seems like this is because RingBufferLogEvent implements 
> ReusableMessage which is where jackson gets the MessageSerializer, whereas 
> the non async LogEvent doesn't, so it gets the BeanSerializer



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


[jira] [Updated] (LOG4J2-2312) Using async appender with json layout causes only the message to be written

2018-04-08 Thread David Knapp (JIRA)

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

David Knapp updated LOG4J2-2312:

Attachment: synchronous_trace.txt

> Using async appender with json layout causes only the message to be written
> ---
>
> Key: LOG4J2-2312
> URL: https://issues.apache.org/jira/browse/LOG4J2-2312
> Project: Log4j 2
>  Issue Type: Bug
>Reporter: David Knapp
>Priority: Major
> Attachments: synchronous_trace.txt
>
>
> When using the async appender combined with the JsonLayout, you only get the 
> results of the message being written to the appender.
>  
> I took a look at it seems like this is because RingBufferLogEvent implements 
> ReusableMessage which is where jackson gets the MessageSerializer, whereas 
> the non async LogEvent doesn't, so it gets the BeanSerializer



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