250x250
Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- IntelliJ
- MSSQL
- Eclipse
- git
- ubuntu
- PostgreSQL
- Source
- MySQL
- JavaScript
- Python
- error
- Exception
- Thymeleaf
- Open Source
- 오픈소스
- 문서
- SpringBoot
- 설정
- Docker
- oracle
- Core Java
- myBatis
- jpa
- JDBC
- maven
- STS
- Spring Boot
- Tomcat
- spring
- AJAX
Archives
- Today
- Total
헤르메스 LIFE
[log4j2] Log4j2 설정 참고 본문
728x90
항상 뭔가 급하면 찾게 된다.
pom.xml
<properties>
<org.slf4j-version>1.7.36</org.slf4j-version>
<log4j-version>2.18.0</log4j-version>
</properties>
<!-- 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>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j-version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j-version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>${log4j-version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j-version}</version>
<type>pom</type>
<exclusions>
<exclusion>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</exclusion>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
</exclusions>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.bgee.log4jdbc-log4j2</groupId>
<artifactId>log4jdbc-log4j2-jdbc4.1</artifactId>
<version>1.16</version>
<exclusions>
<exclusion>
<groupId>slf4j-api</groupId>
<artifactId>org.slf4j.api</artifactId>
</exclusion>
</exclusions>
</dependency>
log4j2.xml
<?xml version="1.0" encoding="UTF-8">
<Configuration>
<Appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n"/>
</Console>
</Appenders>
<Loggers>
<!-- Spring -->
<Logger name="org.springframework" level="OFF" additivity="false">
<AppenderRef ref="console"/>
</Logger>
<Logger name="org.springframework.web.servlet.DispatcherServlet" level="DEBUG" additivity="false">
<AppenderRef ref="console"/>
</Logger>
<Logger
name="org.springframework.context.support.ReloadableResourceBundleMessageSource"
level="OFF" additivity="false">
<AppenderRef ref="console"/>
</Logger>
<Logger name="org.hotswap" level="OFF" additivity="false">
</Logger>
<Logger name="jdbc.connection" level="OFF" additivity="false">
<AppenderRef ref="console"/>
</Logger>
<Logger name="jdbc.sqlonly" level="INFO" additivity="false">
<AppenderRef ref="console"/>
</Logger>
<Logger name="jdbc.sqltiming" level="OFF" additivity="false">
<AppenderRef ref="console"/>
</Logger>
<Logger name="jdbc.audit" level="OFF" additivity="false">
<AppenderRef ref="console"/>
</Logger>
<Logger name="jdbc.resultset" level="OFF" additivity="false">
<AppenderRef ref="console"/>
</Logger>
<Logger name="jdbc.resultsettable" level="OFF" additivity="false">
<AppenderRef ref="console"/>
</Logger>
<Root level="ERROR">
<AppenderRef ref="console"/>
</Root>
</Loggers>
</Configuration>
src/main/resources경로에 log4jdbc.log4j2.properties를 작성한다.
log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator
.dump.sql.maxlinelength=0
https://hermeslog.tistory.com/643
728x90
'Spring Framework' 카테고리의 다른 글
[Spring] 개발환경 구축 - Hello World (0) | 2022.12.20 |
---|---|
[Maven] 로컬 Dependency (0) | 2022.12.16 |
[Redis] SpringBoot + Redis (0) | 2022.11.23 |
[JNDI] 간단한 Tomcat + JSP + JNDI 테스트 (0) | 2022.11.21 |
[개발환경] Spring + Maven + MyBatis + PostgreSQL (0) | 2022.11.20 |