728x90
๋ฐ์ํ
๐ ๋ก๊ทธ๋ ์ ํํ ํ์ํ ๋ด์ฉ์ ๊ผญ ๊ธฐ๋กํ๋๊ฒ ์ข์.
LIB ์ค์ (MAVEN)
pom.xml
* JDBC
<!-- https://mvnrepository.com/artifact/org.bgee.log4jdbc-log4j2/log4jdbc-log4j2-jdbc4.1 -->
<dependency>
<groupId>org.bgee.log4jdbc-log4j2</groupId>
<artifactId>log4jdbc-log4j2-jdbc4.1</artifactId>
<version>1.16</version>
</dependency>
* slf4j (slf4j ์ธํฐํ์ด์ค์ log4j2๋ฅผ ์ฐ๊ฒฐํด์ฃผ๋ ๋ชจ๋ ์ญํ )
* ์ทจ์ฝ์ ์๋ ์ต์ ๋ฒ์ ์ผ๋ก ์์
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j-impl -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.17.2</version>
</dependency>
* log4j api / core
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.17.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.17.2</version>
</dependency>
* spring settings
<packaging>war</packaging>
<version>1.0.0-BUILD-SNAPSHOT</version>
<properties>
<java-version>1.8</java-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<org.springframework-version>5.3.13</org.springframework-version>
<org.aspectj-version>1.8.9</org.aspectj-version>
<org.apache.axis2-version>1.7.4</org.apache.axis2-version>
</properties>
log4j2.xml
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="ERROR">
<Appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %level - %m%n%ex%n"/>
</Console>
</Appenders>
<Console name="console-infolog" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %level - %m%n%ex%n"/>
</Console>
<RollingFile name="rolling_error" fileName="D:/app/manager_logs/error.log" filePattern="D:/app/manager_logs/error-%d{yyyy-MM-dd}.log-%i">
<PatternLayout pattern="[%-5p] %d{yy-MM-dd HH:mm:ss} [%C{2}][%M][%L] - %m%n" />
<Policies>
<Policies>
<SizeBasedTriggeringPolicy size="10000KB" />
</Policies>
</Policies>
</RollingFile>
<loggers>
<Root level="INFO" additivity="false" >
<AppenderRef ref="console" />
</Root>
<!-- log4j2 -->
<logger name="log4jdbc.log4j2" level="error" additivity="false">
<appender-ref ref="console" />
</logger>
<!-- QUERY LOG -->
<logger name="jdbc.sqlonly" additivity="false" level="INFO">
<appender-ref ref="console" />
</logger>
<!-- RESULTSET TABLE -->
<logger name="jdbc.resultsettable" additivity="false" level="INFO">
<appender-ref ref="console" />
</logger>
<!-- query + time -->
<logger name="jdbc.sqltiming" level="off"/>
<!-- ์ ์ฒด ๋ก๊ทธ ( ์ ์๋นํ ๋ง์์ง ) -->
<logger name="jdbc.audit" level="off"/>
<!-- resultsettable + resultset (parameter) -->
<logger name="jdbc.resultset" level="off"/>
<!-- connection log -->
<logger name="jdbc.connection" level="off"/>
<logger name = "com.error" level="INFO" additivity="false" >
<AppenderRef ref="rolling_error"/>
</logger>
<logger name = "com.console" level="INFO" additivity="false">
<AppenderRef ref="rolling_console"/>
</logger>
</loggers>
</Configuration>
log4jdbc.log4j2.properties
log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator
log4jdbc.dump.sql.maxlinelength=0
๊ฒฐ๊ณผ :
320x100
๋ฐ์ํ
'JAVA > SPRING' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
springBoot / mapstruct (0) | 2022.06.08 |
---|---|
spring boot / H2 DB ์ธํ (0) | 2022.05.29 |
Hikari CP / Spring boot ์ค์ (0) | 2022.05.23 |
QueryDSL , Criteria , Native Query (0) | 2022.05.09 |
Spring cloud config (0) | 2022.02.03 |