Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- Python
- NPM
- Kotlin
- react
- SSL
- Express
- 보조정렬
- mapreduce
- Android
- Java
- Sqoop
- xPlatform
- GIT
- plugin
- Spring
- Eclipse
- R
- hadoop
- JavaScript
- table
- vaadin
- SPC
- 공정능력
- mybatis
- IntelliJ
- MSSQL
- window
- tomcat
- es6
- SQL
Archives
- Today
- Total
DBILITY
logback에서 springframework log가 출력되지 않을때 본문
반응형
springframework은 jakarta commons logging을 사용하므로, commons-logging의 dependancy를 제거(exclude)하고,
slf4j-api dependancy 확인 후 jcl-over-slf4j dependancy를 추가한다( slf4j Bridging legacy APIs 참조 )
- spring mvc pom sample
<properties> <java-version>1.6</java-version> <org.springframework-version>3.1.1.RELEASE</org.springframework-version> <org.aspectj-version>1.6.10</org.aspectj-version> <org.slf4j-version>1.6.6</org.slf4j-version> <cglib-verion>2.2</cglib-verion> </properties> <dependencies> <!-- Spring --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>${org.springframework-version}</version> <exclusions> <!-- Exclude Commons Logging in favor of SLF4j --> <exclusion> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>${org.springframework-version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-tx</artifactId> <version>${org.springframework-version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <version>${org.springframework-version}</version> </dependency> <!-- Logging --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>${org.slf4j-version}</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>jcl-over-slf4j</artifactId> <version>${org.slf4j-version}</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>log4j-over-slf4j</artifactId> <version>${org.slf4j-version}</version> </dependency> <dependency> <groupId>org.lazyluke</groupId> <artifactId>log4jdbc-remix</artifactId> <version>0.2.7</version> <exclusions> <exclusion> <artifactId>slf4j-api</artifactId> <groupId>org.slf4j</groupId> </exclusion> </exclusions> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>1.0.9</version> <exclusions> <exclusion> <artifactId>slf4j-api</artifactId> <groupId>org.slf4j</groupId> </exclusion> </exclusions> </dependency> </dependencies>
- logback.xml sample
<?xml version="1.0" encoding="UTF-8"?> <configuration> <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> <!-- encoders are assigned the type ch.qos.logback.classic.encoder.PatternLayoutEncoder by default --> <encoder> <!-- <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> --> <!-- <pattern>%d{HH:mm:ss.SSS} %-5level %logger{36} - %msg%n</pattern> --> <!-- <pattern>%d{HH:mm:ss.SSS} [%thread] %-7level %50.50logger{36} %4.4L - %msg%n</pattern> --> <!-- <pattern>%d{HH:mm:ss.SSS} %-5level %40.40logger{36} %4.4L - %msg%n</pattern> --> <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %40.40logger{36} %4.4L - %msg%n%ex{full, DISPLAY_EX_EVAL}</pattern> <!-- <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %40.40logger{36} %4.4L - %msg%n\n%caller{3, CALLER_DISPLAY_EVAL}\n%ex{full, DISPLAY_EX_EVAL}</pattern> --> </encoder> </appender> <appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${catalina.base}/logs/logFile.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>${catalina.base}/logs/logFile.%d{yyyy-MM-dd}.log</fileNamePattern> <maxHistory>30</maxHistory> <cleanHistoryOnStart>true</cleanHistoryOnStart> </rollingPolicy> <encoder> <pattern>%d{HH:mm:ss.SSS} [%thread] %-7level %50.50logger{36} %4.4L - %msg%n%ex{full, DISPLAY_EX_EVAL}</pattern> <!-- <pattern>%d{HH:mm:ss.SSS} %-5level %logger{36} - %msg%n</pattern> --> </encoder> </appender> <!-- Application Loggers --> <logger name="com.dbility.apps" additivity="false"> <level value="debug" /> <appender-ref ref="console" /> <appender-ref ref="file" /> </logger> <!-- 3rdparty Loggers --> <logger name="org.springframework" additivity="false"> <level value="info" /> <appender-ref ref="console" /> <appender-ref ref="file" /> </logger> <logger name="jdbc.connection" additivity="false"> <level value="info" /> <appender-ref ref="console" /> </logger> <logger name="jdbc.sqlonly" additivity="false"> <level value="info" /> <appender-ref ref="console" /> </logger> <logger name="jdbc.resultsettable" additivity="false"> <level value="info" /> <appender-ref ref="console" /> </logger> <root level="warn"> <appender-ref ref="console" /> </root> </configuration>
반응형
'java > spring' 카테고리의 다른 글
PropertyPlaceholder에 ARIA Crypto 적용하기 (0) | 2017.09.07 |
---|---|
spring bean programmatically register to web applicaton context (0) | 2016.10.24 |
spring mybatis stored procedure ( oracle ) (0) | 2016.09.24 |
java spring cron expression (0) | 2016.09.20 |
spring jta db,file transaction examination (0) | 2016.09.09 |
Comments