반응형
https://howtodoinjava.com/log4j2/log4j2-properties-example/
https://www.logicbig.com/tutorials/misc/java-logging/slf4j-with-log4j2.html
https://logging.apache.org/log4j/2.x/manual/configuration.html
https://howtodoinjava.com/log4j2/log4j2-rollingfileappender-example/
----------------------------------------------------------------------------------------------------------------
log4j 2로 바꿧는데, console 에는 찍히는데 파일에는 안찍힐 경우.
https://stackoverflow.com/questions/37362920/log4j2-does-not-write-to-file
name = PropertiesConfig
property.filename = logs/example.log
appenders = console, rolling
appender.console.type = Console
appender.console.name = STDOUT
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{dd.MM.yyyy HH:mm:ss,SSS} %-5p %c{1}:%L - %m%n
appender.rolling.type = RollingFile
appender.rolling.name = roll
appender.rolling.fileName = ${filename}
appender.rolling.filePattern = logs/app/%d{MM-dd-yy-HH-mm-ss}-%i.log.gz
appender.rolling.layout.type = PatternLayout
appender.rolling.layout.pattern = %d{dd.MM.yyyy HH:mm:ss,SSS} %-5p %c{1}:%L - %m%n
appender.rolling.policies.type = Policies
appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
appender.rolling.policies.time.interval = 2
appender.rolling.policies.time.modulate = true
appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
appender.rolling.policies.size.size=100MB
appender.rolling.strategy.type = DefaultRolloverStrategy
appender.rolling.strategy.max = 5
loggers = rolling
logger.rolling.name = org.apache.logging.log4j.core.appender.rolling
logger.rolling.level = all
logger.rolling.additivity = true
logger.rolling.appenderRefs = rolling
logger.rolling.appenderRef.rolling.ref = roll
rootLogger.level = all
rootLogger.appenderRefs = rolling, stdout
rootLogger.appenderRef.rolling.ref = roll
rootLogger.appenderRef.stdout.ref = STDOUT
반응형
'Web > 스프링' 카테고리의 다른 글
log4j2.properties 프로퍼티 완료 예제. 트러블슈팅 내용 포함 (0) | 2018.11.29 |
---|---|
spring REST API Json 응답 에러 .No converter found for return value of type: class org.json.JSONObject (0) | 2018.11.27 |
SLF4J with Log4j2 example xml 설정 (0) | 2018.11.22 |
[ ibatis ] batch 기능 (0) | 2018.10.29 |
[ibatis] select 하는 컬럼이 유동적일 경우 (0) | 2018.10.17 |
댓글