Java/mybatis

Mybatis 로그 설정

바리새인 2024. 12. 28. 21:28

logback
/resourcs/logback-spring.xml

<configuration>
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss} %-5level %logger{36} - %msg%n</pattern>
        </encoder>
    </appender>

    <logger name="org.mybatis" level="DEBUG" additivity="false">
        <appender-ref ref="STDOUT" />
    </logger>
    <logger name="org.apache.ibatis" level="DEBUG" additivity="false">
        <appender-ref ref="STDOUT" />
    </logger>

    <root level="INFO">
        <appender-ref ref="STDOUT" />
    </root>
</configuration>

Spring boot

application.properties

logging.level.org.mybatis=DEBUG
logging.level.org.apache.ibatis=DEBUG
logging.level.java.sql.PreparedStatement=DEBUG
logging.level.java.sql.Statement=DEBUG
logging.level.java.sql.ResultSet=DEBUG

application.yml

logging:
	level:
    	org:
        	mybatis: DEBUG

logging:
	level:
		'[org.mybatis]': DEBUG