[ https://issues.apache.org/jira/browse/LOG4J2-152?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Remko Popma updated LOG4J2-152: ------------------------------- Description: ERROR StatusLogger Error in synchronous task java.lang.NullPointerException at org.apache.logging.log4j.core.appender.rolling.helper.FileRenameAction.execute(FileRenameAction.java:85) at org.apache.logging.log4j.core.appender.rolling.helper.FileRenameAction.execute(FileRenameAction.java:71) at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.rollover(RollingFileManager.java:140) at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.checkRollover(RollingFileManager.java:97) at atlas.infra.log.RollingRandomAccessFileAppender.append(RollingRandomAccessFileAppender.java:52) at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:98) at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:335) at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:316) at org.apache.logging.log4j.core.Logger$PrivateConfig.logEvent(Logger.java:304) To reproduce, in log4j2.xml, specify a filePattern without a parent directory: <appenders> <RollingFile name="RollingFile" fileName="logs/app.log" filePattern="fileWithoutParentDir-%d{MM-dd-yyyy}-%i.log.gz"> To fix, change org.apache.logging.log4j.core.appender.rolling.helper.FileRenameAction#execute(File, File, boolean) (line 85): add null check: if (parent != null && !parent.exists()) { // parent is null if not specified in filePattern was: {code} ERROR StatusLogger Error in synchronous task java.lang.NullPointerException at org.apache.logging.log4j.core.appender.rolling.helper.FileRenameAction.execute(FileRenameAction.java:85) at org.apache.logging.log4j.core.appender.rolling.helper.FileRenameAction.execute(FileRenameAction.java:71) at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.rollover(RollingFileManager.java:140) at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.checkRollover(RollingFileManager.java:97) at atlas.infra.log.RollingRandomAccessFileAppender.append(RollingRandomAccessFileAppender.java:52) at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:98) at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:335) at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:316) at org.apache.logging.log4j.core.Logger$PrivateConfig.logEvent(Logger.java:304) {code} To reproduce, in log4j2.xml, specify a filePattern without a parent directory: <appenders> <RollingFile name="RollingFile" fileName="logs/app.log" filePattern="fileWithoutParentDir-%d{MM-dd-yyyy}-%i.log.gz"> This can be fixed in org.apache.logging.log4j.core.appender.rolling.helper.FileRenameAction#execute(File, File, boolean) (line 85) by changing (CURRENT) if (!parent.exists()) { to (FIX) if (parent != null && !parent.exists()) { > NullPointerException in (...)appender.rolling.helper.FileRenameAction if > filePattern does not contain a parent directory > ------------------------------------------------------------------------------------------------------------------------ > > Key: LOG4J2-152 > URL: https://issues.apache.org/jira/browse/LOG4J2-152 > Project: Log4j 2 > Issue Type: New Feature > Components: Appenders > Affects Versions: 2.0-beta2 > Reporter: Remko Popma > > ERROR StatusLogger Error in synchronous task java.lang.NullPointerException > at > org.apache.logging.log4j.core.appender.rolling.helper.FileRenameAction.execute(FileRenameAction.java:85) > at > org.apache.logging.log4j.core.appender.rolling.helper.FileRenameAction.execute(FileRenameAction.java:71) > at > org.apache.logging.log4j.core.appender.rolling.RollingFileManager.rollover(RollingFileManager.java:140) > at > org.apache.logging.log4j.core.appender.rolling.RollingFileManager.checkRollover(RollingFileManager.java:97) > at > atlas.infra.log.RollingRandomAccessFileAppender.append(RollingRandomAccessFileAppender.java:52) > at > org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:98) > at > org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:335) > at > org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:316) > at > org.apache.logging.log4j.core.Logger$PrivateConfig.logEvent(Logger.java:304) > To reproduce, in log4j2.xml, specify a filePattern without a parent directory: > <appenders> > <RollingFile name="RollingFile" fileName="logs/app.log" > filePattern="fileWithoutParentDir-%d{MM-dd-yyyy}-%i.log.gz"> > To fix, change > org.apache.logging.log4j.core.appender.rolling.helper.FileRenameAction#execute(File, > File, boolean) (line 85): add null check: > if (parent != null && !parent.exists()) { // parent is null if not specified > in filePattern -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org