You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/11/06 18:17:00 UTC

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

    [ https://issues.apache.org/jira/browse/LOG4J2-2101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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 <c4...@gmail.com>
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)