karaf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grzegorz Grzybek <gr.grzy...@gmail.com>
Subject Re: [K4.1] Pax Logging: Sift appender
Date Wed, 27 Mar 2019 14:38:37 GMT
Hello

I have this appender:

# Sift appender
log4j2.appender.mdc.type = Routing
log4j2.appender.mdc.name = SiftAppender
log4j2.appender.mdc.routes.type = Routes
# see: http://logging.apache.org/log4j/2.x/manual/appenders.html#Routes
log4j2.appender.mdc.routes.pattern = $\\{ctx:bundle.name}
log4j2.appender.mdc.routes.sift.type = Route
log4j2.appender.mdc.routes.sift.appender.type = RollingRandomAccessFile
log4j2.appender.mdc.routes.sift.appender.name = RollingFile
log4j2.appender.mdc.routes.sift.appender.fileName =
${karaf.data}/log/sift-$\\{ctx:bundle.name}.log
log4j2.appender.mdc.routes.sift.appender.filePattern =
${karaf.data}/log/sift-$\\{ctx:bundle.name}-%i.log.gz
log4j2.appender.mdc.routes.sift.appender.append = true
log4j2.appender.mdc.routes.sift.appender.layout.type = PatternLayout
log4j2.appender.mdc.routes.sift.appender.layout.pattern = ${log4j2.pattern}
log4j2.appender.mdc.routes.sift.appender.policies.type = Policies
log4j2.appender.mdc.routes.sift.appender.policies.size.type =
SizeBasedTriggeringPolicy
log4j2.appender.mdc.routes.sift.appender.policies.size.size = 16MB
log4j2.appender.mdc.routes.sift.appender.strategy.type =
DefaultRolloverStrategy
log4j2.appender.mdc.routes.sift.appender.strategy.max = 20

which splits by bundle name. And template assigment from logger to appender:


# sample logger using Sift appender
#log4j2.logger.example.name = org.apache.camel
#log4j2.logger.example.level = INFO
#log4j2.logger.example.appenderRef.SiftAppender.ref = SiftAppender

There's https://ops4j1.jira.com/browse/PAXLOGGING-243 issue which I'm going
to fix as soon as I get out of my current tasks. This issue is that if you
use the same logger/category, in different bundles, some internal caches in
pax-logging-log4j2 will incorrectly assume single bundle...

regards
Grzegorz Grzybek

śr., 27 mar 2019 o 15:26 Jayamani <jayamanijai92@gmail.com> napisał(a):

> Thanks Grzegorz, i will try with mdc.
>
> i am not getting the whole picture of this shift appender and mdc in
> log4j2...if anyone know how to config pax logging in karaf 4.2.3 to create
> separate log file for each bundle, please share complete
> org.ops4j.pax.logging.cfg file.
>
> Thanks in advance.
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message