[jboss-jira] [JBoss JIRA] (LOGMGR-191) Amend NullPointerException in regex filters
James Perkins (JIRA)
issues at jboss.org
Thu Mar 8 13:02:00 EST 2018
[ https://issues.jboss.org/browse/LOGMGR-191?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
James Perkins reassigned LOGMGR-191:
------------------------------------
Assignee: James Perkins (was: Toshiya Kobayashi)
> Amend NullPointerException in regex filters
> -------------------------------------------
>
> Key: LOGMGR-191
> URL: https://issues.jboss.org/browse/LOGMGR-191
> Project: JBoss Log Manager
> Issue Type: Bug
> Components: core
> Affects Versions: 2.1.0.Alpha5
> Reporter: Toshiya Kobayashi
> Assignee: James Perkins
> Labels: support
> Fix For: 1.3.3.Final, 1.4.4.Final, 1.5.10.Final, 2.0.10.Final, 2.1.0.Alpha6
>
>
> When log message is null, RegexFilter.isLoggable() throws NullPointerException.
> https://github.com/jboss-logging/jboss-logmanager/blob/master/src/main/java/org/jboss/logmanager/filters/RegexFilter.java#L63
> It often results in unexpected outcomes. For example, assuming you have a filter-spec with "not(match(xxx))" to suppress some messages in your logger configuration:
> {code:xml}
> <subsystem xmlns="urn:jboss:domain:logging:3.0">
> <console-handler name="CONSOLE">
> <level name="INFO"/>
> <filter-spec value="not(match("SOME_MESSAGE"))"/>
> <formatter>
> <named-formatter name="COLOR-PATTERN"/>
> </formatter>
> </console-handler>
> {code}
> and an application has a code like this:
> {code:java}
> try {
> ...
> } catch (Exception e) {
> logger.error(e.getMessage(), e);
> }
> {code}
> "e.getMessage()" could be null. But you want to log the stacktrace 'e' anyway.
> In this case, NullPointerException is thrown from RegexFilter and reaches to LoggerNode and disappears. ConsoleHandler cannot publish the log at all.
> https://github.com/jboss-logging/jboss-logmanager/blob/master/src/main/java/org/jboss/logmanager/LoggerNode.java#L317-L319
> I think 'null' message should simply return 'false' in RegexFilter.isLoggable().
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
More information about the jboss-jira
mailing list