From dc299ed815e4e92e178f9fd6ae19f8cd50ad0647 Mon Sep 17 00:00:00 2001 From: Marcus G K Williams Date: Thu, 14 Sep 2017 15:15:45 -0700 Subject: Add Graph/Node to org.ops4j.pax.logging.cfg This change adds org.ops4j.pax.logging.cfg file that contains standard ODL logging config with added sections for 'Directed Graph Node Id appender' and 'Directed Graph Name appender'. Addition of these sections should allow current Graph and Node Id to be appended to karaf log using MDC. Issue-Id: CCSDK-71 Change-Id: Id62ba038fbe6bb51e2c58f6a415a860cfa11dd89 Signed-off-by: Marcus G K Williams --- odlsli/src/main/docker/Dockerfile | 2 + .../src/main/resources/org.ops4j.pax.logging.cfg | 64 ++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 odlsli/src/main/resources/org.ops4j.pax.logging.cfg diff --git a/odlsli/src/main/docker/Dockerfile b/odlsli/src/main/docker/Dockerfile index b2a00f91..74dd5143 100644 --- a/odlsli/src/main/docker/Dockerfile +++ b/odlsli/src/main/docker/Dockerfile @@ -11,5 +11,7 @@ COPY idmlight.db.mv.db /opt/opendaylight/current # copy deliverables to opt COPY opt /opt +COPY org.ops4j.pax.logging.cfg /opt/opendaylight/current/etc/org.ops4j.pax.logging.cfg + # ENTRYPOINT exec /opt/opendaylight/current/bin/karaf EXPOSE 8181 diff --git a/odlsli/src/main/resources/org.ops4j.pax.logging.cfg b/odlsli/src/main/resources/org.ops4j.pax.logging.cfg new file mode 100644 index 00000000..7a575e4a --- /dev/null +++ b/odlsli/src/main/resources/org.ops4j.pax.logging.cfg @@ -0,0 +1,64 @@ +# Root logger +log4j.rootLogger=INFO, async, directed-graph-node-id, directed-graph, osgi:* +log4j.throwableRenderer=org.apache.log4j.OsgiThrowableRenderer + +# CONSOLE appender not used by default +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n + +# Async appender forwarding to file appender +log4j.appender.async=org.apache.log4j.AsyncAppender +log4j.appender.async.appenders=out + +# File appender +log4j.appender.out=org.apache.log4j.RollingFileAppender +log4j.appender.out.layout=org.apache.log4j.PatternLayout +log4j.appender.out.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n +log4j.appender.out.file=${karaf.data}/log/karaf.log +log4j.appender.out.append=true +log4j.appender.out.maxFileSize=1MB +log4j.appender.out.maxBackupIndex=10 + +# Directed Graph Node Id appender +log4j.appender.directed-graph-node-id=org.apache.log4j.sift.MDCSiftingAppender +log4j.appender.directed-graph-node-id.key=nodeId +log4j.appender.directed-graph-node-id.default=unknown +log4j.appender.directed-graph-node-id.appender=org.apache.log4j.FileAppender +log4j.appender.directed-graph-node-id.appender.layout=org.apache.log4j.PatternLayout +log4j.appender.directed-graph-node-id.appender.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %X{nodeId} | %m%n +log4j.appender.directed-graph-node-id.appender.file=${karaf.data}/log/$\\{nodeId\\}.log +log4j.appender.directed-graph-node-id.appender.append=true + +# Directed Graph Name appender +log4j.appender.directed-graph=org.apache.log4j.sift.MDCSiftingAppender +log4j.appender.directed-graph.key=currentGraph +log4j.appender.directed-graph.default=unknown +log4j.appender.directed-graph.appender=org.apache.log4j.FileAppender +log4j.appender.directed-graph.appender.layout=org.apache.log4j.PatternLayout +log4j.appender.directed-graph.appender.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %X{currentGraph} | %m%n +log4j.appender.directed-graph.appender.file=${karaf.data}/log/$\\{currentGraph\\}.log +log4j.appender.directed-graph.appender.append=true + +# Sift appender +log4j.appender.sift=org.apache.log4j.sift.MDCSiftingAppender +log4j.appender.sift.key=bundle.name +log4j.appender.sift.default=karaf +log4j.appender.sift.appender=org.apache.log4j.FileAppender +log4j.appender.sift.appender.layout=org.apache.log4j.PatternLayout +log4j.appender.sift.appender.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %m%n +log4j.appender.sift.appender.file=${karaf.data}/log/$\\{bundle.name\\}.log +log4j.appender.sift.appender.append=true + +# syslog appender for exporting karaf messages to a syslog server +# To enable the syslog appender, add it to the log4j.rootLogger list above. +# +# Make sure to set log4j.appender.syslog.syslogHost in the format: +# : +# If no port is specified, the default, 514, is assumed. +log4j.appender.syslog=org.apache.log4j.net.SyslogAppender +log4j.appender.syslog.layout=org.apache.log4j.PatternLayout +log4j.appender.syslog.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %X{currentGraph} | %X{nodeId} | %m%n +log4j.appender.syslog.syslogHost=127.0.0.1 +log4J.appender.syslog.facility=KARAF +log4j.appender.syslog.facilityPrinting=false -- cgit 1.2.3-korg