Java

log4j.properties 샘플코드




# Log4j Setting file

log4j.rootLogger=INFO, console

# log4j init message display

log4j.debug=false

# Console log

log4j.appender.console=org.apache.log4j.ConsoleAppender

log4j.appender.console.layout=org.apache.log4j.PatternLayout

log4j.appender.console.layout.ConversionPattern=%-5p: %m%n

# Daily file log for daily Log 

log4j.appender.daily=org.apache.log4j.CompositeRollingAppender

#How to perform rolling -- Composite is the default

#1:By Size, 2:By Time

log4j.appender.daily.RollingStyle=3

#Use same file name for all inprocess logging?

log4j.appender.daily.staticLogFileName=true

log4j.appender.daily.File=/logs/wellness_sp_v2/daily.log

#Size Rolling params

#By default newer files have lower numbers. (countDirection < 0)  

log4j.appender.daily.CountDirection=-1

log4j.appender.daily.MaxFileSize=50MB

log4j.appender.daily.MaxSizeRollBackups=100

#Date Rolling params

log4j.appender.daily.datePattern='.'yyyyMMdd

#layout options

log4j.appender.daily.layout=org.apache.log4j.PatternLayout

log4j.appender.daily.layout.ConversionPattern=[%d{yyyy-MM-dd HH:mm:ss:SSS}] %-5p - %m%n

log4j.appender.ibatis=org.apache.log4j.CompositeRollingAppender

#How to perform rolling -- Composite is the default

#1:By Size, 2:By Time

log4j.appender.ibatis.RollingStyle=3

#Use same file name for all inprocess logging?

log4j.appender.ibatis.staticLogFileName=true

log4j.appender.ibatis.File=/logs/wellness_sp_v2/ibatis.log

#Size Rolling params

#By default newer files have lower numbers. (countDirection < 0)  

log4j.appender.ibatis.CountDirection=-1

log4j.appender.ibatis.MaxFileSize=50MB

log4j.appender.ibatis.MaxSizeRollBackups=100

#Date Rolling params

log4j.appender.ibatis.datePattern='.'yyyyMMdd

#layout options

log4j.appender.ibatis.layout=org.apache.log4j.PatternLayout

log4j.appender.ibatis.layout.ConversionPattern=[%d{yyyy-MM-dd HH:mm:ss:SSS}] %-5p - %m%n

log4j.logger.java.sql=DEBUG, ibatis

log4j.logger.org.springframework.jdbc=DEBUG, ibatis

org.mybatis.spring=DEBUG, ibatis

log4j.category.business.info=DEBUG,daily

Leave a Reply

error: Content is protected !!