[jira] [Commented] (LOG4J2-2104) LoaderUtil getClassLoaders() method and while loops

2017-11-06 Thread Ralph Goers (JIRA)

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

Ralph Goers commented on LOG4J2-2104:
-

First, why is this a Jira issue? Simple questions like this should be on the 
dev list.

Yes. This method returns all the ClassLoaders to search for a Log4j 
implementation. Although the ThreadContextClassLoader shouldn't be there twice 
it won't really hurt anything.

> LoaderUtil getClassLoaders() method and while loops
> ---
>
> Key: LOG4J2-2104
> URL: https://issues.apache.org/jira/browse/LOG4J2-2104
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.9.1
>Reporter: Andrejus Chaliapinas
>Priority: Minor
>
> For v2.9.1 inside org.apache.logging.log4j.util.LoaderUtil and 
> getClassLoaders() method we have lines 120-123 as such:
> ClassLoader parent = tcl;
> while (parent != null && !classLoaders.contains(parent)) {
> classLoaders.add(parent);
> }
> where it looks like some getParent() call is either missing or otherwise 
> "while" loop is not needed.
> In line 111 tcl classloader already added into list of clasloaders:
> classLoaders.add(tcl);
> Was it an attempt to add all classloaders hierarchy or just some immediate 
> parents?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (LOG4J2-2105) ClassLoaderContextSelector should key based on log4j classes

2017-11-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on LOG4J2-2105:


Github user cakofony commented on the issue:

https://github.com/apache/logging-log4j2/pull/113
  
updated


> ClassLoaderContextSelector should key based on log4j classes
> 
>
> Key: LOG4J2-2105
> URL: https://issues.apache.org/jira/browse/LOG4J2-2105
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core
>Reporter: Carter Douglas Kozak
>
> ClassLoaderContextSelector should create context map keys based on the 
> instances of log4j-core classes, not necessarily the classloader. When log4j 
> is initialized as shared beween sub loaders, sharing a single context is 
> preferrable.
> AsyncLoggerContextSelector defautlt context name shouldn't depend on the 
> current thread name.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[GitHub] logging-log4j2 issue #113: LOG4J2-2105: ClassLoaderContextSelector more resi...

2017-11-06 Thread cakofony
Github user cakofony commented on the issue:

https://github.com/apache/logging-log4j2/pull/113
  
updated


---


[jira] [Created] (LOG4J2-2105) ClassLoaderContextSelector should key based on log4j classes

2017-11-06 Thread Carter Douglas Kozak (JIRA)
Carter Douglas Kozak created LOG4J2-2105:


 Summary: ClassLoaderContextSelector should key based on log4j 
classes
 Key: LOG4J2-2105
 URL: https://issues.apache.org/jira/browse/LOG4J2-2105
 Project: Log4j 2
  Issue Type: Bug
  Components: Core
Reporter: Carter Douglas Kozak


ClassLoaderContextSelector should create context map keys based on the 
instances of log4j-core classes, not necessarily the classloader. When log4j is 
initialized as shared beween sub loaders, sharing a single context is 
preferrable.

AsyncLoggerContextSelector defautlt context name shouldn't depend on the 
current thread name.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (LOG4J2-2101) non-string value MapMessage ClassCastException

2017-11-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on LOG4J2-2101:


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

https://github.com/apache/logging-log4j2/pull/124#discussion_r149243922
  
--- Diff: 
log4j-api/src/test/java/org/apache/logging/log4j/message/MapMessageTest.java ---
@@ -99,4 +102,29 @@ public void testMutableByDesign() { // LOG4J2-763
 final String expected2 = "{key1=\"value1\", key2=\"value2\", 
key3=\"value3\"}";
 assertEquals(expected2, result2);
 }
+
+@Test
+public void testGetNonStringValue() {
+final String key = "Key";
+final MapMessage msg = new MapMessage<>()
+.with(key, 1L);
+assertEquals("1", msg.get(key));
+}
+
+@Test
+public void testRemoveNonStringValue() {
+final String key = "Key";
+final MapMessage msg = new MapMessage<>()
+.with(key, 1L);
+assertEquals("1", msg.remove(key));
+}
+
+@Test
+public void testJSONFormatNonStringValue() {
--- End diff --

Updated. Good call, turns out it was broken!


> non-string value MapMessage ClassCastException
> --
>
> Key: LOG4J2-2101
> URL: https://issues.apache.org/jira/browse/LOG4J2-2101
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Filters
>Affects Versions: 2.9.1
>Reporter: Carter Douglas Kozak
>
> Using a MapFilter with a MapMessage containing non-string values results in a 
> ClassCastException attempting to cast values to strings.
> {noformat}
> ClassCastException: java.lang.Long cannot be cast to java.lang.String
> at org.apache.logging.log4j.message.MapMessage.get(MapMessage.java:214)
> at 
> org.apache.logging.log4j.core.filter.MapFilter.filter(MapFilter.java:87)
> at 
> org.apache.logging.log4j.core.filter.MapFilter.filter(MapFilter.java:79)
> at 
> org.apache.logging.log4j.core.filter.AbstractFilterable.isFiltered(AbstractFilterable.java:182)
> at 
> org.apache.logging.log4j.core.config.AppenderControl.isFilteredByAppender(AppenderControl.java:151)
> at 
> org.apache.logging.log4j.core.config.AppenderControl.callAppender0(AppenderControl.java:128)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (LOG4J2-2102) MapMessage JSON encoding should escape keys and values

2017-11-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on LOG4J2-2102:


Github user cakofony commented on the issue:

https://github.com/apache/logging-log4j2/pull/125
  
Updated, thanks!


> MapMessage JSON encoding should escape keys and values
> --
>
> Key: LOG4J2-2102
> URL: https://issues.apache.org/jira/browse/LOG4J2-2102
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Layouts
>Affects Versions: 2.9.1
>Reporter: Carter Douglas Kozak
>
> Writing a map message as json does not currently escape quotes, resulting in 
> invalid json



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[GitHub] logging-log4j2 pull request #124: LOG4J2-2101: MapMessage correctly handles ...

2017-11-06 Thread cakofony
Github user cakofony commented on a diff in the pull request:

https://github.com/apache/logging-log4j2/pull/124#discussion_r149243922
  
--- Diff: 
log4j-api/src/test/java/org/apache/logging/log4j/message/MapMessageTest.java ---
@@ -99,4 +102,29 @@ public void testMutableByDesign() { // LOG4J2-763
 final String expected2 = "{key1=\"value1\", key2=\"value2\", 
key3=\"value3\"}";
 assertEquals(expected2, result2);
 }
+
+@Test
+public void testGetNonStringValue() {
+final String key = "Key";
+final MapMessage msg = new MapMessage<>()
+.with(key, 1L);
+assertEquals("1", msg.get(key));
+}
+
+@Test
+public void testRemoveNonStringValue() {
+final String key = "Key";
+final MapMessage msg = new MapMessage<>()
+.with(key, 1L);
+assertEquals("1", msg.remove(key));
+}
+
+@Test
+public void testJSONFormatNonStringValue() {
--- End diff --

Updated. Good call, turns out it was broken!


---


[jira] [Created] (LOG4J2-2104) LoaderUtil getClassLoaders() method and while loops

2017-11-06 Thread Andrejus Chaliapinas (JIRA)
Andrejus Chaliapinas created LOG4J2-2104:


 Summary: LoaderUtil getClassLoaders() method and while loops
 Key: LOG4J2-2104
 URL: https://issues.apache.org/jira/browse/LOG4J2-2104
 Project: Log4j 2
  Issue Type: Bug
  Components: Core
Affects Versions: 2.9.1
Reporter: Andrejus Chaliapinas
Priority: Minor


For v2.9.1 inside org.apache.logging.log4j.util.LoaderUtil and 
getClassLoaders() method we have lines 120-123 as such:

ClassLoader parent = tcl;
while (parent != null && !classLoaders.contains(parent)) {
classLoaders.add(parent);
}

where it looks like some getParent() call is either missing or otherwise 
"while" loop is not needed.

In line 111 tcl classloader already added into list of clasloaders:
classLoaders.add(tcl);

Was it an attempt to add all classloaders hierarchy or just some immediate 
parents?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[GitHub] logging-log4j2 pull request #105: Marker examples should not use deprecate f...

2017-11-06 Thread asfgit
Github user asfgit closed the pull request at:

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


---


[GitHub] logging-log4j2 issue #113: ClassLoaderContextSelector more resilient to mult...

2017-11-06 Thread mikaelstaldal
Github user mikaelstaldal commented on the issue:

https://github.com/apache/logging-log4j2/pull/113
  
It would be nice to have a JIRA issue for this.


---


[jira] [Commented] (LOG4J2-2101) non-string value MapMessage ClassCastException

2017-11-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on LOG4J2-2101:


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

https://github.com/apache/logging-log4j2/pull/124#discussion_r149195504
  
--- Diff: 
log4j-api/src/test/java/org/apache/logging/log4j/message/MapMessageTest.java ---
@@ -99,4 +102,29 @@ public void testMutableByDesign() { // LOG4J2-763
 final String expected2 = "{key1=\"value1\", key2=\"value2\", 
key3=\"value3\"}";
 assertEquals(expected2, result2);
 }
+
+@Test
+public void testGetNonStringValue() {
+final String key = "Key";
+final MapMessage msg = new MapMessage<>()
+.with(key, 1L);
+assertEquals("1", msg.get(key));
+}
+
+@Test
+public void testRemoveNonStringValue() {
+final String key = "Key";
+final MapMessage msg = new MapMessage<>()
+.with(key, 1L);
+assertEquals("1", msg.remove(key));
+}
+
+@Test
+public void testJSONFormatNonStringValue() {
--- End diff --

Would be nice to test XML format of non-String value as well.


> non-string value MapMessage ClassCastException
> --
>
> Key: LOG4J2-2101
> URL: https://issues.apache.org/jira/browse/LOG4J2-2101
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Filters
>Affects Versions: 2.9.1
>Reporter: Carter Douglas Kozak
>
> Using a MapFilter with a MapMessage containing non-string values results in a 
> ClassCastException attempting to cast values to strings.
> {noformat}
> ClassCastException: java.lang.Long cannot be cast to java.lang.String
> at org.apache.logging.log4j.message.MapMessage.get(MapMessage.java:214)
> at 
> org.apache.logging.log4j.core.filter.MapFilter.filter(MapFilter.java:87)
> at 
> org.apache.logging.log4j.core.filter.MapFilter.filter(MapFilter.java:79)
> at 
> org.apache.logging.log4j.core.filter.AbstractFilterable.isFiltered(AbstractFilterable.java:182)
> at 
> org.apache.logging.log4j.core.config.AppenderControl.isFilteredByAppender(AppenderControl.java:151)
> at 
> org.apache.logging.log4j.core.config.AppenderControl.callAppender0(AppenderControl.java:128)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[GitHub] logging-log4j2 pull request #124: LOG4J2-2101: MapMessage correctly handles ...

2017-11-06 Thread mikaelstaldal
Github user mikaelstaldal commented on a diff in the pull request:

https://github.com/apache/logging-log4j2/pull/124#discussion_r149195504
  
--- Diff: 
log4j-api/src/test/java/org/apache/logging/log4j/message/MapMessageTest.java ---
@@ -99,4 +102,29 @@ public void testMutableByDesign() { // LOG4J2-763
 final String expected2 = "{key1=\"value1\", key2=\"value2\", 
key3=\"value3\"}";
 assertEquals(expected2, result2);
 }
+
+@Test
+public void testGetNonStringValue() {
+final String key = "Key";
+final MapMessage msg = new MapMessage<>()
+.with(key, 1L);
+assertEquals("1", msg.get(key));
+}
+
+@Test
+public void testRemoveNonStringValue() {
+final String key = "Key";
+final MapMessage msg = new MapMessage<>()
+.with(key, 1L);
+assertEquals("1", msg.remove(key));
+}
+
+@Test
+public void testJSONFormatNonStringValue() {
--- End diff --

Would be nice to test XML format of non-String value as well.


---


[jira] [Commented] (LOG4J2-2102) MapMessage JSON encoding should escape keys and values

2017-11-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on LOG4J2-2102:


Github user mikaelstaldal commented on the issue:

https://github.com/apache/logging-log4j2/pull/125
  
We should do the same for the XML format, you can use the new XML format in 
`EncodingPatternConverter` for that (pull from master). Good to place that in a 
shared utility class.


> MapMessage JSON encoding should escape keys and values
> --
>
> Key: LOG4J2-2102
> URL: https://issues.apache.org/jira/browse/LOG4J2-2102
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Layouts
>Affects Versions: 2.9.1
>Reporter: Carter Douglas Kozak
>
> Writing a map message as json does not currently escape quotes, resulting in 
> invalid json



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[GitHub] logging-log4j2 issue #125: LOG4J2-2102: MapMessage Json encoding escapes key...

2017-11-06 Thread mikaelstaldal
Github user mikaelstaldal commented on the issue:

https://github.com/apache/logging-log4j2/pull/125
  
We should do the same for the XML format, you can use the new XML format in 
`EncodingPatternConverter` for that (pull from master). Good to place that in a 
shared utility class.


---


[jira] [Resolved] (LOG4J2-2103) XML encoding for PatternLayout

2017-11-06 Thread JIRA

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

Mikael Ståldal resolved LOG4J2-2103.

   Resolution: Fixed
Fix Version/s: 2.10.0

In Git master.

> XML encoding for PatternLayout
> --
>
> Key: LOG4J2-2103
> URL: https://issues.apache.org/jira/browse/LOG4J2-2103
> Project: Log4j 2
>  Issue Type: Improvement
>  Components: Pattern Converters
>Affects Versions: 2.9.1
>Reporter: Mikael Ståldal
>Assignee: Mikael Ståldal
>Priority: Minor
> Fix For: 2.10.0
>
>
> It could be useful with a strict XML encoding for PatternLayout, which would 
> be a subset of HTML encoding, without line break encoding (which should not 
> be needed for strict XML).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Updated] (LOG4J2-2103) XML encoding for PatternLayout

2017-11-06 Thread JIRA

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

Mikael Ståldal updated LOG4J2-2103:
---
Component/s: (was: Layouts)
 Pattern Converters

> XML encoding for PatternLayout
> --
>
> Key: LOG4J2-2103
> URL: https://issues.apache.org/jira/browse/LOG4J2-2103
> Project: Log4j 2
>  Issue Type: Improvement
>  Components: Pattern Converters
>Affects Versions: 2.9.1
>Reporter: Mikael Ståldal
>Priority: Minor
>
> It could be useful with a strict XML encoding for PatternLayout, which would 
> be a subset of HTML encoding, without line break encoding (which should not 
> be needed for strict XML).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Created] (LOG4J2-2103) XML encoding for PatternLayout

2017-11-06 Thread JIRA
Mikael Ståldal created LOG4J2-2103:
--

 Summary: XML encoding for PatternLayout
 Key: LOG4J2-2103
 URL: https://issues.apache.org/jira/browse/LOG4J2-2103
 Project: Log4j 2
  Issue Type: Improvement
  Components: Layouts
Affects Versions: 2.9.1
Reporter: Mikael Ståldal
Priority: Minor


It could be useful with a strict XML encoding for PatternLayout, which would be 
a subset of HTML encoding, without line break encoding (which should not be 
needed for strict XML).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (LOG4J2-2102) MapMessage JSON encoding should escape keys and values

2017-11-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on LOG4J2-2102:


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

https://github.com/apache/logging-log4j2/pull/125#discussion_r149168416
  
--- Diff: 
log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/EncodingPatternConverter.java
 ---
@@ -86,100 +87,4 @@ public void format(final LogEvent event, final 
StringBuilder toAppendTo) {
 }
 escapeFormat.escape(toAppendTo, start);
 }
-
-private enum EscapeFormat {
-HTML {
-@Override
-void escape(final StringBuilder toAppendTo, final int start) {
-for (int i = toAppendTo.length() - 1; i >= start; i--) { 
// backwards: length may change
-final char c = toAppendTo.charAt(i);
-switch (c) {
-case '\r':
-toAppendTo.setCharAt(i, '\\');
-toAppendTo.insert(i + 1, 'r');
-break;
-case '\n':
-toAppendTo.setCharAt(i, '\\');
-toAppendTo.insert(i + 1, 'n');
-break;
-case '&':
-toAppendTo.setCharAt(i, '&');
-toAppendTo.insert(i + 1, "amp;");
-break;
-case '<':
-toAppendTo.setCharAt(i, '&');
-toAppendTo.insert(i + 1, "lt;");
-break;
-case '>':
-toAppendTo.setCharAt(i, '&');
-toAppendTo.insert(i + 1, "gt;");
-break;
-case '"':
-toAppendTo.setCharAt(i, '&');
-toAppendTo.insert(i + 1, "quot;");
-break;
-case '\'':
-toAppendTo.setCharAt(i, '&');
-toAppendTo.insert(i + 1, "apos;");
-break;
-case '/':
-toAppendTo.setCharAt(i, '&');
-toAppendTo.insert(i + 1, "#x2F;");
-break;
-}
-}
-}
-},
-
-/**
- * JSON string escaping as defined in RFC 4627.
- *
- * @see https://www.ietf.org/rfc/rfc4627.txt;>RFC 4627
- */
-JSON {
-@Override
-void escape(final StringBuilder toAppendTo, final int start) {
-for (int i = toAppendTo.length() - 1; i >= start; i--) { 
// backwards: length may change
-final char c = toAppendTo.charAt(i);
-if (Character.isISOControl(c)) {
-// all iso control characters are in U+00xx
-toAppendTo.setCharAt(i, '\\');
-toAppendTo.insert(i + 1, "u");
-toAppendTo.setCharAt(i + 4, 
Chars.getUpperCaseHex((c & 0xF0) >> 4));
-toAppendTo.setCharAt(i + 5, 
Chars.getUpperCaseHex(c & 0xF));
-} else if (c == '"' || c == '\\') {
-// only " and \ need to be escaped; other escapes 
are optional
-toAppendTo.insert(i, '\\');
-}
-}
-}
-},
-
-CRLF {
-@Override
-void escape(final StringBuilder toAppendTo, final int start) {
-for (int i = toAppendTo.length() - 1; i >= start; i--) { 
// backwards: length may change
-final char c = toAppendTo.charAt(i);
-switch (c) {
-case '\r':
-toAppendTo.setCharAt(i, '\\');
-toAppendTo.insert(i + 1, 'r');
-break;
-case '\n':
-toAppendTo.setCharAt(i, '\\');
-toAppendTo.insert(i + 1, 'n');
-break;
-}
-}
-}
-};
-
-/**
- * Escapes text using a standardized format from a given starting 
point to 

[jira] [Commented] (LOG4J2-2102) MapMessage JSON encoding should escape keys and values

2017-11-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on LOG4J2-2102:


GitHub user cakofony opened a pull request:

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

LOG4J2-2102: MapMessage Json encoding escapes key and value strings



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

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

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

https://github.com/apache/logging-log4j2/pull/125.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 #125


commit 163f3db588b4b46a9bbddbd28f64fb65b5e4e292
Author: Carter Kozak 
Date:   2017-11-06T18:49:36Z

LOG4J2-2102: MapMessage Json encoding escapes key and value strings




> MapMessage JSON encoding should escape keys and values
> --
>
> Key: LOG4J2-2102
> URL: https://issues.apache.org/jira/browse/LOG4J2-2102
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Layouts
>Affects Versions: 2.9.1
>Reporter: Carter Douglas Kozak
>
> Writing a map message as json does not currently escape quotes, resulting in 
> invalid json



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[GitHub] logging-log4j2 pull request #125: LOG4J2-2102: MapMessage Json encoding esca...

2017-11-06 Thread cakofony
GitHub user cakofony opened a pull request:

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

LOG4J2-2102: MapMessage Json encoding escapes key and value strings



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

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

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

https://github.com/apache/logging-log4j2/pull/125.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 #125


commit 163f3db588b4b46a9bbddbd28f64fb65b5e4e292
Author: Carter Kozak 
Date:   2017-11-06T18:49:36Z

LOG4J2-2102: MapMessage Json encoding escapes key and value strings




---


[jira] [Created] (LOG4J2-2102) MapMessage JSON encoding should escape keys and values

2017-11-06 Thread Carter Douglas Kozak (JIRA)
Carter Douglas Kozak created LOG4J2-2102:


 Summary: MapMessage JSON encoding should escape keys and values
 Key: LOG4J2-2102
 URL: https://issues.apache.org/jira/browse/LOG4J2-2102
 Project: Log4j 2
  Issue Type: Bug
  Components: Layouts
Affects Versions: 2.9.1
Reporter: Carter Douglas Kozak


Writing a map message as json does not currently escape quotes, resulting in 
invalid json



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


Jenkins build is back to normal : Log4j 2.x #3157

2017-11-06 Thread Apache Jenkins Server
See 




[jira] [Commented] (LOG4J2-2101) non-string value MapMessage ClassCastException

2017-11-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on LOG4J2-2101:


GitHub user cakofony opened a pull request:

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

LOG4J2-2101: MapMessage correctly handles non-string map values

Previously formatting non-string values worked, however filtering,
which uess the "get" method would fail due to MapMessage attempting
to cast values to String.

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

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

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

https://github.com/apache/logging-log4j2/pull/124.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 #124


commit 33af2479457613b0e9d1e560a38b4ad19e23d810
Author: Carter Kozak 
Date:   2017-11-06T18:14:36Z

LOG4J2-2101: MapMessage correctly handles non-string map values

Previously formatting non-string values worked, however filtering,
which uess the "get" method would fail due to MapMessage attempting
to cast values to String.




> non-string value MapMessage ClassCastException
> --
>
> Key: LOG4J2-2101
> URL: https://issues.apache.org/jira/browse/LOG4J2-2101
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Filters
>Affects Versions: 2.9.1
>Reporter: Carter Douglas Kozak
>
> Using a MapFilter with a MapMessage containing non-string values results in a 
> ClassCastException attempting to cast values to strings.
> {noformat}
> ClassCastException: java.lang.Long cannot be cast to java.lang.String
> at org.apache.logging.log4j.message.MapMessage.get(MapMessage.java:214)
> at 
> org.apache.logging.log4j.core.filter.MapFilter.filter(MapFilter.java:87)
> at 
> org.apache.logging.log4j.core.filter.MapFilter.filter(MapFilter.java:79)
> at 
> org.apache.logging.log4j.core.filter.AbstractFilterable.isFiltered(AbstractFilterable.java:182)
> at 
> org.apache.logging.log4j.core.config.AppenderControl.isFilteredByAppender(AppenderControl.java:151)
> at 
> org.apache.logging.log4j.core.config.AppenderControl.callAppender0(AppenderControl.java:128)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[GitHub] logging-log4j2 pull request #124: LOG4J2-2101: MapMessage correctly handles ...

2017-11-06 Thread cakofony
GitHub user cakofony opened a pull request:

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

LOG4J2-2101: MapMessage correctly handles non-string map values

Previously formatting non-string values worked, however filtering,
which uess the "get" method would fail due to MapMessage attempting
to cast values to String.

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

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

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

https://github.com/apache/logging-log4j2/pull/124.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 #124


commit 33af2479457613b0e9d1e560a38b4ad19e23d810
Author: Carter Kozak 
Date:   2017-11-06T18:14:36Z

LOG4J2-2101: MapMessage correctly handles non-string map values

Previously formatting non-string values worked, however filtering,
which uess the "get" method would fail due to MapMessage attempting
to cast values to String.




---


[jira] [Created] (LOG4J2-2101) non-string value MapMessage ClassCastException

2017-11-06 Thread Carter Douglas Kozak (JIRA)
Carter Douglas Kozak created LOG4J2-2101:


 Summary: non-string value MapMessage ClassCastException
 Key: LOG4J2-2101
 URL: https://issues.apache.org/jira/browse/LOG4J2-2101
 Project: Log4j 2
  Issue Type: Bug
  Components: Filters
Affects Versions: 2.9.1
Reporter: Carter Douglas Kozak


Using a MapFilter with a MapMessage containing non-string values results in a 
ClassCastException attempting to cast values to strings.


{noformat}
ClassCastException: java.lang.Long cannot be cast to java.lang.String
at org.apache.logging.log4j.message.MapMessage.get(MapMessage.java:214)
at org.apache.logging.log4j.core.filter.MapFilter.filter(MapFilter.java:87)
at org.apache.logging.log4j.core.filter.MapFilter.filter(MapFilter.java:79)
at 
org.apache.logging.log4j.core.filter.AbstractFilterable.isFiltered(AbstractFilterable.java:182)
at 
org.apache.logging.log4j.core.config.AppenderControl.isFilteredByAppender(AppenderControl.java:151)
at 
org.apache.logging.log4j.core.config.AppenderControl.callAppender0(AppenderControl.java:128)
{noformat}




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


Build failed in Jenkins: Log4j 2.x #3156

2017-11-06 Thread Apache Jenkins Server
See 


Changes:

[ggregory] [LOG4J2-2077] Update from Jackson 2.9.1 to 2.9.2.

--
[...truncated 22.70 KB...]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] Copying 3 resources
[INFO] Copying 3 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ log4j-api ---
[INFO] Toolchain in maven-compiler-plugin: 
JDK[/home/jenkins/tools/java/latest1.7]
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 123 source files to 
/home/jenkins/jenkins-slave/workspace/Log4j 2.x/log4j-api/target/classes
[WARNING] /home/jenkins/jenkins-slave/workspace/Log4j 
2.x/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java:[916,17]
 [deprecation] exit(R) in Logger has been deprecated
  where R is a type-variable:
R extends Object declared in method exit(R)
[WARNING] /home/jenkins/jenkins-slave/workspace/Log4j 
2.x/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java:[911,16]
 [deprecation] exit() in Logger has been deprecated
[WARNING] /home/jenkins/jenkins-slave/workspace/Log4j 
2.x/log4j-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java:[582,16]
 [deprecation] entry() in Logger has been deprecated
[WARNING] /home/jenkins/jenkins-slave/workspace/Log4j 
2.x/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java:[146,60]
 [unchecked] unchecked cast
  required: V
  found:String
  where V is a type-variable:
V extends Object declared in method forEach(BiConsumer)
[WARNING] /home/jenkins/jenkins-slave/workspace/Log4j 
2.x/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java:[157,60]
 [unchecked] unchecked cast
  required: V
  found:String
  where V,S are type-variables:
V extends Object declared in method forEach(TriConsumer,S)
S extends Object declared in method forEach(TriConsumer,S)
[WARNING] /home/jenkins/jenkins-slave/workspace/Log4j 
2.x/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java:[34,7]
 [serial] serializable class DefaultThreadContextMap has no definition of 
serialVersionUID
[WARNING] /home/jenkins/jenkins-slave/workspace/Log4j 
2.x/log4j-api/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteSortedArrayThreadContextMap.java:[156,18]
 [unchecked] getValue(String) in CopyOnWriteSortedArrayThreadContextMap 
implements getValue(String) in ObjectThreadContextMap
  return type requires unchecked conversion from Object to V
  where V is a type-variable:
V extends Object declared in method getValue(String)
[WARNING] /home/jenkins/jenkins-slave/workspace/Log4j 
2.x/log4j-api/src/main/java/org/apache/logging/log4j/message/StructuredDataCollectionMessage.java:[28,7]
 [serial] serializable class StructuredDataCollectionMessage has no definition 
of serialVersionUID
[WARNING] /home/jenkins/jenkins-slave/workspace/Log4j 
2.x/log4j-api/src/main/java/org/apache/logging/log4j/spi/GarbageFreeSortedArrayThreadContextMap.java:[150,18]
 [unchecked] getValue(String) in GarbageFreeSortedArrayThreadContextMap 
implements getValue(String) in ObjectThreadContextMap
  return type requires unchecked conversion from Object to V
  where V is a type-variable:
V extends Object declared in method getValue(String)
[WARNING] /home/jenkins/jenkins-slave/workspace/Log4j 
2.x/log4j-api/src/main/java/org/apache/logging/log4j/message/ParameterizedNoReferenceMessageFactory.java:[48,11]
 [serial] serializable class StatusMessage has no definition of serialVersionUID
[INFO] 
[INFO] --- maven-bundle-plugin:3.3.0:manifest (default) @ log4j-api ---
[INFO] 
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ 
log4j-api ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 8 resources
[INFO] Copying 3 resources
[INFO] Copying 3 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ 
log4j-api ---
[INFO] Toolchain in maven-compiler-plugin: 
JDK[/home/jenkins/tools/java/latest1.7]
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 78 source files to /home/jenkins/jenkins-slave/workspace/Log4j 
2.x/log4j-api/target/test-classes
[WARNING] /home/jenkins/jenkins-slave/workspace/Log4j 
2.x/log4j-api/src/test/java/org/apache/logging/log4j/util/StackLocatorUtilTest.java:[25,18]
 Reflection is internal proprietary API and may be removed in a future release
[WARNING] warning: No processor claimed any of these annotations: 
org.junit.AfterClass,org.junit.Ignore,org.junit.Before,org.junit.runners.Parameterized.Parameters,org.junit.ClassRule,org.junit.Rule,org.junit.After,org.junit.runner.RunWith,org.junit.BeforeClass,org.junit.Test
/home/jenkins/jenkins-slave/workspace/Log4j 

[GitHub] logging-log4j2 issue #121: (doc) Remove wrong xml tag ""

2017-11-06 Thread dr0i
Github user dr0i commented on the issue:

https://github.com/apache/logging-log4j2/pull/121
  
@mikaelstaldal Yes, I have `log4j-1.2-api` on the classpath. Anyway, I 
don't need the `Log4j1XmlLayout` - I was just wondering why a docu-snippet 
wasn't working right out of the box.


---