You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by eq...@laposte.net on 2017/11/14 14:42:40 UTC
MDC log purge
Hi,
We are going to create a MDC log with a sift appender:
# Sift appender
log4j.appender.sift=org.apache.log4j.sift.MDCSiftingAppender
log4j.appender.sift.key=bundle.name
log4j.appender.sift.default=tesb
log4j.appender.sift.appender=org.apache.log4j.FileAppender
log4j.appender.sift.appender.layout=org.apache.log4j.PatternLayout
log4j.appender.sift.appender.layout.ConversionPattern=%d{ABSOLUTE} | %-5.5p | %-16.16t | %-32.32c{1} | %-32.32C %4L | %m%n
log4j.appender.sift.appender.file=${karaf.data}/log/$\\{bundle.name\\}.log
log4j.appender.sift.appender.append=true
I'm concerned about the way we will be handle to keep the size log low.
Indeed if I'm not wrong, it is going to grow up constantly with this kind of appender.
What is the right strategy to keep its size low ?
Thanks for your help.
Eric
Re: MDC log purge
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Eric,
You combine the sift appender with a rolling file appender.
As you can see your sift appender is a FileAppender.
Instead, you can use a RollingFileAppender, with a size, backup, etc.
So, it will rotate and purge automatically.
Regards
JB
On 11/14/2017 03:42 PM, equefellec@laposte.net wrote:
> Hi,
>
>
> We are going to create a MDC log with a sift appender:
> *# Sift appender*
> *log4j.appender.sift=org.apache.log4j.sift.MDCSiftingAppender*
> *log4j.appender.sift.key=bundle.name*
> *log4j.appender.sift.default=tesb*
> *log4j.appender.sift.appender=org.apache.log4j.FileAppender*
> *log4j.appender.sift.appender.layout=org.apache.log4j.PatternLayout*
> *log4j.appender.sift.appender.layout.ConversionPattern=%d{ABSOLUTE} | %-5.5p |
> %-16.16t | %-32.32c{1} | %-32.32C %4L | %m%n*
> *log4j.appender.sift.appender.file=${karaf.data}/log/$\\{bundle.name\\}.log*
> *log4j.appender.sift.appender.append=true*
>
>
> I'm concerned about the way we will be handle to keep the size log low.
>
>
> Indeed if I'm not wrong, it is going to grow up constantly with this kind of
> appender.
>
>
> What is the right strategy to keep its size low ?
>
>
> Thanks for your help.
>
>
> Eric
>
--
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com