Create custom log4j appender for Karaf and Pax Logging
Karaf leverages Pax Logging for the logging layer. Pax Logging provides an abstraction service for most popular logging frameworks, like SLF4J, Log4j, commons-logging, etc. Karaf provides a default logging configuration in etc/org.ops4j.pax.logging.cfg file. By default, all INFO log messages (rootLogger) are send into a file appender (in data/log/karaf.log). The file appender “maintains” one file of 1MB, and store up to 10 backup files. Adding a new appender configuration, example with Syslog appender We can add new appender configuration in the Karaf logging module. For instance, we can add a syslog appender in etc/org.ops4j.pax.logging.cfg: log4j.rootLogger = INFO, out, syslog, osgi:* ... # Syslog appender log4j.appender.syslog=org.apache.log4j.net.SyslogAppender log4j.appender.syslog.layout=org.apache.log4j.PatternLayout log4j.appender.syslog.layout.ConversionPattern=[%p] %c:%L - %m%n log4j.appender.syslog.syslogHost=localhost log4J.appender.syslog.facility=KARAF log4j.ap...