기존 콘솔 메세지
수정 후 콘솔 메세지
수정 사항
SizeAndTimeBasedFNATP
대신 SizeAndTimeBasedRollingPolicy
사용하라는 경고 메세지
16:17:03,712 |-WARN in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@38089a5a - SizeAndTimeBasedFNATP is deprecated. Use SizeAndTimeBasedRollingPolicy instead
16:17:03,712 |-WARN in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@38089a5a - For more information see <http://logback.qos.ch/manual/appenders.html#SizeAndTimeBasedRollingPolicy>
logback.xml 파일에서 사용중인 SizeAndTimeBasedFNATP 를 SizeAndTimeBasedRollingPolicy 로 변경
변경전
<appender name="JSON_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>logs/${FILE_NAME}-json.log</File>
<encoder class="net.logstash.logback.encoder.LogstashEncoder"/>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>logs/${FILE_NAME}_%d{yyyy-MM-dd}.%i.json</FileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.**SizeAndTimeBasedFNATP**">
<maxFileSize>50MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>7</maxHistory>
</rollingPolicy>
</appender>
변경후
<appender name="JSON_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>logs/${FILE_NAME}-json.log</File>
<encoder class="net.logstash.logback.encoder.LogstashEncoder"/>
<rollingPolicy class="ch.qos.logback.core.rolling.**SizeAndTimeBasedRollingPolicy**">
<FileNamePattern>logs/${FILE_NAME}_%d{yyyy-MM-dd}.%i.json</FileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>7</maxHistory>
</rollingPolicy>
</appender>
References
logback.xml 파일에 springProfile
태그 미적용 이슈
16:17:03,721 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@41:29 - no applicable action for [springProfile], current ElementPath is [[configuration][springProfile]]
16:17:03,721 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@42:22 - no applicable action for [root], current ElementPath is [[configuration][springProfile][root]]
16:17:03,721 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@43:32 - no applicable action for [appender-ref], current ElementPath is [[configuration][springProfile][root][appender-ref]]
16:17:03,722 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@46:30 - no applicable action for [springProfile], current ElementPath is [[configuration][springProfile]]
16:17:03,723 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@47:22 - no applicable action for [root], current ElementPath is [[configuration][springProfile][root]]
16:17:03,723 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@48:37 - no applicable action for [appender-ref], current ElementPath is [[configuration][springProfile][root][appender-ref]]
logback.xml → logback-spring.xml 이름 변경
MyBatis mapper scan 오류
20230209 16:17:06.455 [restartedMain] WARN o.m.s.m.ClassPathMapperScanner - No MyBatis mapper was found in '[mapper]' package. Please check your configuration.
Mybatis @Mapper 어노테이션이 달린 인터페이스의 패키지 경로를 찾지 못해 생기는 오류
@MapperScan 의 basePackages 경로 수정
@MapperScan(basePackages = "com.payhada.admin.dao")
com.mysql.jdbc.Driver
드라이버 deprecated 이슈
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
log4jdbc 에서 사용되는 mysql driver 변경. log4jdbc.log4j2.properties
파일 수정
log4jdbc.auto.load.popular.drivers=false
log4jdbc.drivers=com.mysql.cj.jdbc.Driver
MyBatis 버전 관련 경고 메세지
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.ibatis.reflection.Reflector (file:/Users/payhada-user/.gradle/caches/modules-2/files-2.1/org.mybatis/mybatis/3.4.0/1b37a54d8ab403e56cb3ed717c25193474efa226/mybatis-3.4.0.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.apache.ibatis.reflection.Reflector
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
추후 JDK 버전을 올릴 수 있으므로 미리 MyBatis dependency 버전을 현재 프로젝트의 스프링 버전 내에서 호환 가능한 버전중에 선택하여 올림
mybatis-spring-boot-starter 1.1.1 버전에서 2.2.2 버전으로 버전업
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2'
open-in-view 경고 메세지
20230209 16:17:11.427 [restartedMain] WARN o.s.b.a.o.j.JpaBaseConfiguration$JpaWebConfiguration - spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
open-in-view 는 클라이언트 요청 시 영속성 컨텍스트의 유지 범위를 설정한다 트랜잭션이 비즈니스 로직 외에서도 유지되기 때문에 데이터 변경이 가능하고 자원 낭비 발생으로 인해 경고문이 표시 됨 해당 옵션을 false 로 수정
spring.jpa.open-in-view=false
그 외 수정사항
build.gradle
IntelliJ(Gradle) 권고로 인한 dependency 버전 변경
9.0.31
→ 9.0.69
8.0.13
→ 8.0.28
2.9.1
→ 2.12.4
2.1.3.RELEASE
→ 2.3.12.RELEASE
2.8.2
→ 2.8.9
2.5.6
→ 2.5.14
4.5
→ 4.5.13
1.0
→ 1.13
주석처리 및 미사용 dependency 제거
PayhadaAdminApplication.java
미사용 에러페이지 필터 코드 제거
public class PayhadaAdminApplication extends SpringBootServletInitializer {
...
@Bean
public ErrorPageFilter errorPageFilter() {
return new ErrorPageFilter();
}
@Bean public FilterRegistrationBean<ErrorPageFilter> disableSpringBootErrorFilter(ErrorPageFilter filter) {
FilterRegistrationBean<ErrorPageFilter> filterRegistrationBean = new FilterRegistrationBean<ErrorPageFilter>();
filterRegistrationBean.setFilter(filter);
filterRegistrationBean.setEnabled(false);
return filterRegistrationBean;
}
}
application-{profiles}.properties
주석 코드 제거
web.xml