Hi, I'm working on a project that needs to have tomcat internal logs and application logs in one file. At the moment I'm using logback to log tomcat internals with grgrzybek's project (https://github.com/grgrzybek/tomcat-slf4j-logback) in which there is a modified version of juli that redirects calls to logback - if I didn't understand wrong) and it works really fine, I just modified a bit its logback configuration so that all 4 loggers refer to only 1 appender; for my application I'm using a simple configuration that outputs to a file, uses a size and time based rolling policy:
<configuration scan="true" scanPeriod="30 seconds" > <appender name="MYAPP-TRIAL" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>C:/Users/r0h1/workspace/TestLoggingFrameworks/logs/myapp.log</file> <append>true</append> <encoder> <charset>utf-8</charset> <pattern>MYAPPLICATION TRIAL %d{HH:mm:ss.SSS} %-5level {%thread} [%logger{40}] : %msg%n</pattern> </encoder> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>C:/Users/r0h1/workspace/TestLoggingFrameworks/logs/myapp-%d{yyyyMMdd}-%i.log.zip</fileNamePattern> <maxHistory>60<!-- days --></maxHistory> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>10MB</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> </appender> <root level="info"> <appender-ref ref="MYAPP-TRIAL" /> </root> </configuration> Now I know there are 2 different approaches 1 - using prudent: but i can't use it because of its limitation with the rolling policy (in fact it doesn't work at all with this configuration) 2 - using <include> tag importing the appender from tomcat/conf/logback.xml (I followed logback manual, referencing the appender and so on). This approach doesn't work either, I think because the class used in the tomcat/conf/logback.xml is not logback's classic one: <included> <appender name="MYAPPTEST" class=" org.apache.juli.logging.ch.qos.logback.core.rolling.RollingFileAppender"> <file>C:/Users/r0h1/workspace/TestLoggingFrameworks/logs/myapp.log</file> <encoder> <charset>utf-8</charset> <pattern>%d{HH:mm:ss.SSS} %logger{0} {%thread} %level : %msg%n</pattern> </encoder> <rollingPolicy class="org.apache.juli.logging.ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>C:/Users/r0h1/workspace/TestLoggingFrameworks/logs/myapp-%d{yyyyMMdd}-%i.log.zip</fileNamePattern> <maxHistory>60<!-- days --></maxHistory> <timeBasedFileNamingAndTriggeringPolicy class="org.apache.juli.logging.ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>20MB</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> </appender> </included> Someone got another approach to suggest? or am I making something wrong here? I'm using tomcat x64 7.0.22, logback 1.0.0, Win7 x64 Thanks a lot! Rohi
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user