[JIRA] Created: (LBCLASSIC-231) groovy configuration throws nullpointerexception when configuration SizeAndTimeBasedFNATP

groovy configuration throws nullpointerexception when configuration SizeAndTimeBasedFNATP ----------------------------------------------------------------------------------------- Key: LBCLASSIC-231 URL: http://jira.qos.ch/browse/LBCLASSIC-231 Project: logback-classic Issue Type: Bug Reporter: Jeff Skjonsby Assignee: Logback dev list I have been trying to convert our logging configuration to the groovy based configuration and have run into an issue with setting the SizeAndTimeBasedFNATP up. I used the converter tool to convert our configuration and have also tried the examples in the documentation: import ch.qos.logback.classic.encoder.PatternLayoutEncoder import ch.qos.logback.core.rolling.RollingFileAppender import ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP import ch.qos.logback.core.rolling.TimeBasedRollingPolicy import static ch.qos.logback.classic.Level.DEBUG appender("ROLLING", RollingFileAppender) { file = "mylog.txt" rollingPolicy(TimeBasedRollingPolicy) { fileNamePattern = "mylog-%d{yyyy-MM-dd}.%i.txt" timeBasedFileNamingAndTriggeringPolicy(SizeAndTimeBasedFNATP) { maxFileSize = "100MB" } } encoder(PatternLayoutEncoder) { pattern = "%msg%n" } } root(DEBUG, ["ROLLING"]) Everything I've tried has resulted in this exception: java.lang.NullPointerException at ch.qos.logback.core.rolling.TimeBasedFileNamingAndTriggeringPolicyBase.start(TimeBasedFileNamingAndTriggeringPolicyBase.java:46) at ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP.start(SizeAndTimeBasedFNATP.java:36) ... If I step through the configuration process it appears that on line 46 in TimeBasedFileNamingAndTriggeringPolicyBase the tbrp member variable is null here. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira

[ http://jira.qos.ch/browse/LBCLASSIC-231?page=com.atlassian.jira.plugin.syste... ] Jeff Skjonsby commented on LBCLASSIC-231: ----------------------------------------- I was able to work around the issue by wrapping the rollingPolicy configuration element with a try/catch like this: ... try { rollingPolicy(TimeBasedRollingPolicy) { fileNamePattern = "mylog-%d{yyyy-MM-dd}.%i.txt" timeBasedFileNamingAndTriggeringPolicy(SizeAndTimeBasedFNATP) { maxFileSize = "100MB" } } catch (NullPointerException e) { } ... but this is obviously a hacky workaround
groovy configuration throws nullpointerexception when configuration SizeAndTimeBasedFNATP -----------------------------------------------------------------------------------------
Key: LBCLASSIC-231 URL: http://jira.qos.ch/browse/LBCLASSIC-231 Project: logback-classic Issue Type: Bug Reporter: Jeff Skjonsby Assignee: Logback dev list
I have been trying to convert our logging configuration to the groovy based configuration and have run into an issue with setting the SizeAndTimeBasedFNATP up. I used the converter tool to convert our configuration and have also tried the examples in the documentation: import ch.qos.logback.classic.encoder.PatternLayoutEncoder import ch.qos.logback.core.rolling.RollingFileAppender import ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP import ch.qos.logback.core.rolling.TimeBasedRollingPolicy import static ch.qos.logback.classic.Level.DEBUG appender("ROLLING", RollingFileAppender) { file = "mylog.txt" rollingPolicy(TimeBasedRollingPolicy) { fileNamePattern = "mylog-%d{yyyy-MM-dd}.%i.txt" timeBasedFileNamingAndTriggeringPolicy(SizeAndTimeBasedFNATP) { maxFileSize = "100MB" } } encoder(PatternLayoutEncoder) { pattern = "%msg%n" } } root(DEBUG, ["ROLLING"]) Everything I've tried has resulted in this exception: java.lang.NullPointerException at ch.qos.logback.core.rolling.TimeBasedFileNamingAndTriggeringPolicyBase.start(TimeBasedFileNamingAndTriggeringPolicyBase.java:46) at ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP.start(SizeAndTimeBasedFNATP.java:36) ... If I step through the configuration process it appears that on line 46 in TimeBasedFileNamingAndTriggeringPolicyBase the tbrp member variable is null here.
-- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira

[ http://jira.qos.ch/browse/LBCLASSIC-231?page=com.atlassian.jira.plugin.syste... ] Ceki Gulcu commented on LBCLASSIC-231: -------------------------------------- Fixed in http://github.com/ceki/logback/commit/a0242c2da3c940
groovy configuration throws nullpointerexception when configuration SizeAndTimeBasedFNATP -----------------------------------------------------------------------------------------
Key: LBCLASSIC-231 URL: http://jira.qos.ch/browse/LBCLASSIC-231 Project: logback-classic Issue Type: Bug Reporter: Jeff Skjonsby Assignee: Logback dev list Fix For: unspecified
I have been trying to convert our logging configuration to the groovy based configuration and have run into an issue with setting the SizeAndTimeBasedFNATP up. I used the converter tool to convert our configuration and have also tried the examples in the documentation: import ch.qos.logback.classic.encoder.PatternLayoutEncoder import ch.qos.logback.core.rolling.RollingFileAppender import ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP import ch.qos.logback.core.rolling.TimeBasedRollingPolicy import static ch.qos.logback.classic.Level.DEBUG appender("ROLLING", RollingFileAppender) { file = "mylog.txt" rollingPolicy(TimeBasedRollingPolicy) { fileNamePattern = "mylog-%d{yyyy-MM-dd}.%i.txt" timeBasedFileNamingAndTriggeringPolicy(SizeAndTimeBasedFNATP) { maxFileSize = "100MB" } } encoder(PatternLayoutEncoder) { pattern = "%msg%n" } } root(DEBUG, ["ROLLING"]) Everything I've tried has resulted in this exception: java.lang.NullPointerException at ch.qos.logback.core.rolling.TimeBasedFileNamingAndTriggeringPolicyBase.start(TimeBasedFileNamingAndTriggeringPolicyBase.java:46) at ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP.start(SizeAndTimeBasedFNATP.java:36) ... If I step through the configuration process it appears that on line 46 in TimeBasedFileNamingAndTriggeringPolicyBase the tbrp member variable is null here.
-- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira

[ http://jira.qos.ch/browse/LBCLASSIC-231?page=com.atlassian.jira.plugin.syste... ] Ceki Gulcu resolved LBCLASSIC-231. ---------------------------------- Fix Version/s: unspecified Resolution: Fixed
groovy configuration throws nullpointerexception when configuration SizeAndTimeBasedFNATP -----------------------------------------------------------------------------------------
Key: LBCLASSIC-231 URL: http://jira.qos.ch/browse/LBCLASSIC-231 Project: logback-classic Issue Type: Bug Reporter: Jeff Skjonsby Assignee: Logback dev list Fix For: unspecified
I have been trying to convert our logging configuration to the groovy based configuration and have run into an issue with setting the SizeAndTimeBasedFNATP up. I used the converter tool to convert our configuration and have also tried the examples in the documentation: import ch.qos.logback.classic.encoder.PatternLayoutEncoder import ch.qos.logback.core.rolling.RollingFileAppender import ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP import ch.qos.logback.core.rolling.TimeBasedRollingPolicy import static ch.qos.logback.classic.Level.DEBUG appender("ROLLING", RollingFileAppender) { file = "mylog.txt" rollingPolicy(TimeBasedRollingPolicy) { fileNamePattern = "mylog-%d{yyyy-MM-dd}.%i.txt" timeBasedFileNamingAndTriggeringPolicy(SizeAndTimeBasedFNATP) { maxFileSize = "100MB" } } encoder(PatternLayoutEncoder) { pattern = "%msg%n" } } root(DEBUG, ["ROLLING"]) Everything I've tried has resulted in this exception: java.lang.NullPointerException at ch.qos.logback.core.rolling.TimeBasedFileNamingAndTriggeringPolicyBase.start(TimeBasedFileNamingAndTriggeringPolicyBase.java:46) at ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP.start(SizeAndTimeBasedFNATP.java:36) ... If I step through the configuration process it appears that on line 46 in TimeBasedFileNamingAndTriggeringPolicyBase the tbrp member variable is null here.
-- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
participants (2)
-
Ceki Gulcu (JIRA)
-
Jeff Skjonsby (JIRA)