
?I added the StatusListener and it looks like a classloader issue on my end (or that of org.apache.sling.commons.log): ERROR in ch.qos.logback.core.joran.util.PropertySetter@38be5eb1 - A "ch.qos.logback.core.rolling.TimeBasedRollingPolicy" object is not assignable to a "ch.qos.logback.core.rolling.RollingPolicy" variable. ERROR in ch.qos.logback.core.joran.util.PropertySetter@38be5eb1 - The class "ch.qos.logback.core.rolling.RollingPolicy" was loaded by [ch.qos.logback.core [306]] whereas object of type "ch.qos.logback.core.rolling.TimeBasedRollingPolicy" was loaded by [org.apache.sling.commons.log [14]]. Johny ________________________________ From: Logback-user <logback-user-bounces@qos.ch> on behalf of Johny Johnson <johny.johnson@apx-labs.com> Sent: Tuesday, February 11, 2014 9:49 AM To: logback users list Subject: Re: [logback-user] NPE when extending RollingFileAppender Yeah, the NPE occurs because rollingPolicy is null in the getFile call (triggeringPolicy is also null at this point) but can't seem to figure out why rollingPolicy isn't getting set. If I'm extending the RollingFileAppender do I need to and programmatically set everything it checks for in start() manually (vs. getting it from logback.xml)? Johny ________________________________ From: Logback-user <logback-user-bounces@qos.ch> on behalf of David Roussel <nabble@diroussel.xsmail.com> Sent: Tuesday, February 11, 2014 3:18 AM To: logback users list Subject: Re: [logback-user] NPE when extending RollingFileAppender Did you try stepping through with a debugger to see what was going on? David On 10 Feb 2014, at 20:07, Johny Johnson <johny.johnson@apx-labs.com<mailto:johny.johnson@apx-labs.com>> wrote: Hi, I'm having some trouble getting my custom appender which extends RollingFileAppender working. I've got my logback config being read and can extend FileAppender w/o issues but when I switch over to RollingFileAppender, I get the following: java.lang.NullPointerException: null at ch.qos.logback.core.rolling.RollingFileAppender.getFile(RollingFileAppender.java:122) ~[org.apache.sling.commons.log:4.0.0] Here is my config: <appender name="CUSTOM" class="com.mypackage.logging.CustomLogAppender"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>log.%d{yyyy-MM-dd}.log</fileNamePattern> </rollingPolicy> <prudent>true</prudent> <encoder> <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %logger{36} - %msg%n</pattern> </encoder> </appender> The only method that I override is writeout() as I needed to handle some particular events. Did I missing something obvious in terms of configuration? Any help is appreciated. Thanks! Johny _______________________________________________ Logback-user mailing list Logback-user@qos.ch<mailto:Logback-user@qos.ch> http://mailman.qos.ch/mailman/listinfo/logback-user