[ https://issues.apache.org/jira/browse/LOG4J2-2793?focusedWorklogId=420870&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-420870 ]
ASF GitHub Bot logged work on LOG4J2-2793: ------------------------------------------ Author: ASF GitHub Bot Created on: 12/Apr/20 02:00 Start Date: 12/Apr/20 02:00 Worklog Time Spent: 10m Work Description: rgoers commented on pull request #348: LOG4J2-2793 - Unable to parse the log LEVEL when it ends with SPACE. URL: https://github.com/apache/logging-log4j2/pull/348#discussion_r407133486 ########## File path: log4j-api/src/main/java/org/apache/logging/log4j/Level.java ########## @@ -284,7 +284,8 @@ public static Level toLevel(final String name, final Level defaultLevel) { if (name == null) { return defaultLevel; } - final Level level = LEVELS.get(toUpperCase(name)); + String trimmedName = name.trim(); + final Level level = LEVELS.get(toUpperCase(trimmedName)); Review comment: Why do we need an extra variable? Just `final Level level = LEVELS.get(toUpperCase(name.trim()));` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 420870) Time Spent: 0.5h (was: 20m) > Unable to parse the log LEVEL when it ends with SPACE. > ------------------------------------------------------ > > Key: LOG4J2-2793 > URL: https://issues.apache.org/jira/browse/LOG4J2-2793 > Project: Log4j 2 > Issue Type: Bug > Affects Versions: 2.10.0, 2.13.1 > Reporter: Renukaprasad C > Priority: Major > Time Spent: 0.5h > Remaining Estimate: 0h > > When the level has trailing space, it failed to pase. This is the case when > "monitorInterval" is configured and level got modified. > It should truncate the space and continue. > 2020-02-28 12:29:21,965 Log4j2-TF-21-ConfiguratonFileWatcher-20 WARN Error > while converting string [ERROR ] to type [class > org.apache.logging.log4j.Level]. Using default value [null]. > java.lang.IllegalArgumentException: Unknown level constant [ERROR ]. > at org.apache.logging.log4j.Level.valueOf(Level.java:320) > at > org.apache.logging.log4j.core.config.plugins.convert.TypeConverters$LevelConverter.convert(TypeConverters.java:288) > at > org.apache.logging.log4j.core.config.plugins.convert.TypeConverters$LevelConverter.convert(TypeConverters.java:284) > at > org.apache.logging.log4j.core.config.plugins.convert.TypeConverters.convert(TypeConverters.java:419) > at > org.apache.logging.log4j.core.config.plugins.visitors.AbstractPluginVisitor.convert(AbstractPluginVisitor.java:149) > at > org.apache.logging.log4j.core.config.plugins.visitors.PluginAttributeVisitor.visit(PluginAttributeVisitor.java:45) > at > org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.generateParameters(PluginBuilder.java:248) > at > org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:135) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:958) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:898) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:890) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:513) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:237) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:249) > at > org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545) > at > org.apache.logging.log4j.core.LoggerContext.onChange(LoggerContext.java:667) > at > org.apache.logging.log4j.core.config.ConfiguratonFileWatcher$ReconfigurationRunnable.run(ConfiguratonFileWatcher.java:68) > at java.lang.Thread.run(Thread.java:745) -- This message was sent by Atlassian Jira (v8.3.4#803005)