logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LOG4J2-1559) NPE in Level.isInRange
Date Fri, 02 Sep 2016 20:56:21 GMT

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

ASF GitHub Bot commented on LOG4J2-1559:
----------------------------------------

Github user jvz commented on the issue:

    https://github.com/apache/logging-log4j2/pull/42
  
    If you want to keep it in a single commit, make your changes, then do `git commit --amend`
and `git push --force`. There's also a way to do that using `git rebase -i`, but I find that
overkill for this sort of thing.


> NPE in Level.isInRange
> ----------------------
>
>                 Key: LOG4J2-1559
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1559
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Filters
>    Affects Versions: 2.4, 2.4.1, 2.5, 2.6, 2.6.1, 2.6.2
>         Environment: Windows 10, Java 1.7
>            Reporter: Andrey Plotkin
>         Attachments: 0001-LOG4J2-1559-Check-proper-value-in-LevelRangeFilter.patch
>
>
> I got an NPE during simple test:
> Test class:
> public class Test {
> 	public static void main(String[] args) {
> 		Logger logger = LogManager.getLogger(Test.class);
> 		logger.info("123");
> 	}
> }
> Maven part:
>   <dependencies>
>   	<dependency>
>   		<groupId>org.apache.logging.log4j</groupId>
>   		<artifactId>log4j-core</artifactId>
>   		<version>2.6.2</version>
>   	</dependency>
>   	<dependency>
>   		<groupId>org.apache.logging.log4j</groupId>
>   		<artifactId>log4j-1.2-api</artifactId>
>   		<version>2.6.2</version>
>   	</dependency>
>   </dependencies>
> log4j2.xml part:
> <Configuration>
> 	<Appenders>
> 		<Console name="StdErr" target="SYSTEM_ERR">
> 			<LevelRangeFilter minLevel="WARN" />
> 		</Console>
> 	</Appenders>
> 	<Loggers>
> 		<Root level="all">
> 			<AppenderRef ref="StdErr" />
> 		</Root>
> 	</Loggers>
> </Configuration>
> The NPE is thrown in:
> 	Level.isInRange(Level, Level) line: 155	
> 	LevelRangeFilter.filter(Level) line: 80	
> 	LevelRangeFilter.filter(LogEvent) line: 85	
> 	ConsoleAppender(AbstractFilterable).isFiltered(LogEvent) line: 135	
> 	AppenderControl.isFilteredByAppender(LogEvent) line: 150	
> 	AppenderControl.callAppender0(LogEvent) line: 127	
> 	AppenderControl.callAppenderPreventRecursion(LogEvent) line: 119	
> 	AppenderControl.callAppender(LogEvent) line: 84	
> 	LoggerConfig.callAppenders(LogEvent) line: 390	
> 	LoggerConfig.processLogEvent(LogEvent) line: 375	
> 	LoggerConfig.log(LogEvent) line: 359	
> 	LoggerConfig.log(String, String, Marker, Level, Message, Throwable) line: 349	
> 	AwaitCompletionReliabilityStrategy.log(Supplier<LoggerConfig>, String, String,
Marker, Level, Message, Throwable) line: 63	
> 	Logger.logMessage(String, Level, Marker, Message, Throwable) line: 146	
> 	Logger(Category).maybeLog(String, Level, Object, Throwable) line: 452	
> 	Logger(Category).info(Object) line: 262	
> 	Test.main(String[]) line: 9	
> According to my investigation, degradation was introduced here:
> https://issues.apache.org/jira/browse/LOG4J2-1106
> Bug is in LevelRangeFilter, here:
> final Level actualMaxLevel = minLevel == null ? Level.ERROR : maxLevel;
> It has to be:
> final Level actualMaxLevel = maxLevel == null ? Level.ERROR : maxLevel;



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message