Skip to content

Instantly share code, notes, and snippets.

@fbaligand
Created March 16, 2013 11:32
Show Gist options
  • Save fbaligand/5176028 to your computer and use it in GitHub Desktop.
Save fbaligand/5176028 to your computer and use it in GitHub Desktop.
Fichier de configuration LOG4J, configurable dynamiquement par system properties : niveau de log racine, appender par défaut (console, rollingfile ou dailyrollingfile), répertoire de log
# ROOT LOGGER
log4j.rootLogger=${log4j.rootLevel},${log4j.rootAppender}
# APPENDER CONSOLE
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%-5p;%d{dd/MM/yyyy HH:mm:ss};[%c{1}];%m%n
# APPENDER ROLLING FILE
log4j.appender.rollingfile=org.apache.log4j.RollingFileAppender
log4j.appender.rollingfile.file=${log4j.directory}/myapp.log
log4j.appender.rollingfile.maxFileSize=5MB
log4j.appender.rollingfile.maxBackupIndex=3
log4j.appender.rollingfile.layout=org.apache.log4j.PatternLayout
log4j.appender.rollingfile.layout.ConversionPattern=%-5p;%d{dd/MM/yyyy HH:mm:ss};[%c{1}];%m%n
# APPENDER DAILY ROLLING FILE
log4j.appender.dailyrollingfile=org.apache.log4j.DailyRollingFileAppender
log4j.appender.dailyrollingfile.file=${log4j.directory}/myapp.log
log4j.appender.dailyrollingfile.layout=org.apache.log4j.PatternLayout
log4j.appender.dailyrollingfile.layout.ConversionPattern=%-5p;%d{dd/MM/yyyy HH:mm:ss};[%c{1}];%m%n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment