I have a Spring Mybatis project that uses logback and slf4j for logging.. It is working fine when I used it in eclipse.. But when I deployed my project(.war) in tomcat.. I cant see the sql executed in log file. Im using postgresql DB and Mybatis ORM.
Jar Version:
logback-classic-1.0.3.jar
logback-core-1.0.3.jar
slf4j-api-1.6.4.jar
logback.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- =========================== -->
<!-- THIS IS FOR UNIX RUNTIME -->
<!-- =========================== -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</Pattern>
</layout>
</appender>
<appender name="UNIXFILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>/logs/sample/hps-logfile.log</File>
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>%d{HH:mm:ss.SSS} %-5level %logger - %msg%n</pattern>
</layout>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>/logs/sample/hps-logfile-%d{yyyy-MM-dd}-%i.txt</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>2MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
</appender>
<appender name="ANALYTICS-UNIX" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>/logs/sample/analytics-logfile.log</File>
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>%d{HH:mm:ss.SSS} %-5level %logger - %msg%n</pattern>
</layout>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>/logs/sample/analytics-logfile-%d{yyyy-MM-dd}-%i.txt</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>2MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
</appender>
<logger name="org.mybatis">
<level value="TRACE"/>
<appender-ref ref="UNIXFILE" />
</logger>
<logger name="net.sf.jasperreports.engine" level="DEBUG">
<appender-ref ref="STDOUT" />
<appender-ref ref="ANALYTICS-UNIX" />
</logger>
<logger name="analytics" level="DEBUG" additivity="false">
<appender-ref ref="ANALYTICS-UNIX"/>
</logger>
<root level="debug">
<appender-ref ref="STDOUT" />
<appender-ref ref="UNIXFILE" />
</root>
<!-- =========================== -->
<!-- THIS IS FOR UNIX RUNTIME -->
<!-- =========================== -->
</configuration>
logback.xml is located in WEB-INF/classes
C:/logs/...
)? – Andreaslogback.xml
file correctly? I mean, you talk about you ,war file, but give no information that might be relevant. – Andreas