2014년 4월 5일 토요일
jBoss EAP 6.0에서 SLF4J LogBack 설정하기
jBoss EAP 6.0에서 SLF4J LogBack 설정하기
* jboss.server.base.dir/standalone/configuration/standalone.xml 수정
/********************************************************************************
<subsystem xmlns="urn:jboss:domain:logging:1.1">
<console-handler name="CONSOLE">
<level name="DEBUG"/>
<formatter>
<!--
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
-->
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %s%n"/>
</formatter>
</console-handler>
...
<logger category="com.mydomain">
<level name="DEBUG"/>
</logger>
<root-logger>
<level name="DEBUG"/>
<handlers>
<handler name="CONSOLE"/>
<handler name="FILE"/>
</handlers>
</root-logger>
</subsystem>
********************************************************************************/
jBoss Log Formatter Syntax
https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform/6/html/Administration_and_Configuration_Guide/chap-The_Logging_Subsystem.html#Log_Formatter_Syntax1
%d The current date/time (yyyy-MM-dd HH:mm:ss,SSS form)
%p The level of the log entry (info/debug/etc)
%c The category of the logging event
%t The name of the current thread
%s The simple log message (no exception trace)
%E The exception stack trace (with extended module information)
* pom.xml 수정
/*********************************************************************************
<properties>
<ver.slf4j>1.7.5</ver.slf4j>
<version.logback>1.0.11</version.logback>
</properties>
<dependencies>
...
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${ver.slf4j}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${version.logback}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${version.logback}</version>
</dependency>
...
</dependencies>
********************************************************************************/
* /WEB-INF/jboss-deployment-structure.xml 추가
/********************************************************************************
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="org.slf4j" />
<module name="org.slf4j.impl" />
</exclusions>
</deployment>
</jboss-deployment-structure>
********************************************************************************/
* src/main/resources/logback.xml
/********************************************************************************
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<!--
<pattern>%d %5p | %t | %-55logger{55} | %m %n</pattern>
-->
<pattern>%5p %logger{5} %m%n</pattern>
</encoder>
</appender>
<logger name="com.mydomain">
<level value="DEBUG" />
</logger>
<root>
<level value="DEBUG" />
<appender-ref ref="CONSOLE" />
</root>
</configuration>
********************************************************************************/
http://logback.qos.ch/manual/layouts.html
피드 구독하기:
댓글 (Atom)
댓글 없음:
댓글 쓰기