==== Adding Configurations ====
Rules:
- The configuration has to be stored in classpath. (In eclipse RCP you can store it in a Fragment)
- The path is set relatively to the classpath folders
- The path can be passed sa a JVM attribute:
-Dlog4j.configuration=/log4j_config/alf.log4j.properties -Dlog4j.debug
Example properties File:
# Set root logger level to DEBUG and its only appender to Console.
log4j.rootCategory=INFO, others
log4j.category.de.ivu=DEBUG, IVUfile, IVUconsole
log4j.additivity.de.ivu=false
log4j.category.de.ivu.fare.rcp.gui.accordion=ERROR
##################
# general appender
##################
# console
log4j.appender.others=org.apache.log4j.ConsoleAppender
log4j.appender.others.layout=org.apache.log4j.PatternLayout
log4j.appender.others.layout.ConversionPattern=*GENERAL* %d <%t> [%p] %c - %m%n
log4j.appender.others.Threshold=WARN
##################
# ivu appender
##################
# console
log4j.appender.IVUconsole=org.apache.log4j.ConsoleAppender
log4j.appender.IVUconsole.layout=org.apache.log4j.PatternLayout
log4j.appender.IVUconsole.layout.ConversionPattern=*OVU-LOG* %d <%t> [%p] %c - %m%n
log4j.appender.IVUconsole.Threshold=DEBUG
# file
log4j.appender.IVUfile=org.apache.log4j.RollingFileAppender
log4j.appender.IVUfile.File=./log/application.log
log4j.appender.IVUfile.MaxFileSize=2048KB
log4j.appender.IVUfile.MaxBackupIndex=3
log4j.appender.IVUfile.layout=org.apache.log4j.PatternLayout
log4j.appender.IVUfile.layout.ConversionPattern=*OVU-LOG* %d <%t> [%p] %c - %m%n
log4j.appender.IVUfile.Threshold=DEBUG
==== Property Substitution ====
It is possible to use system properties / environment variables etc. inside the log4j configuration.
The syntax looks as following:
${env:APPDATA}
${sys:osgi.nl.user}
...
All the details about the sysntax and all possible substitution sources are listed here: \\ https://logging.apache.org/log4j/2.0/manual/configuration.html#PropertySubstitution
==== FILTER ====
Filter may be used to filter out some stuff.
E.g. the RegEx Filter is very powerfull and may be placed directly inside the configuraiton, to filter everything: