logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lybarger <m.lybar...@gmail.com>
Subject rolling daily logger
Date Fri, 06 Mar 2015 14:40:03 GMT
i'm using log4j2 for some of the filters (level and dynamic).  I want my
logs to roll based on size (this makes it easy to open in vim), but also by
date (this helps organize them and I only need 1 week of logs).


here's my current configuraiton. i'm un sure how to specify a rollover
strategy that keeps 7 days worth of files with a size based triggering
policy.


any help would be most appreciated.


thanks,

-mark-


 <Appenders>

    <RollingFile name=*"mlog"* fileName=
*"/home/mark/jboss-eap-6.1/standalone/log/mlog.log"* filePattern=
*"/home/mark/jboss-eap-6.1/standalone/log/mlog-%d{yyyy-MM-dd}.log.%i"*>

      <PatternLayout pattern=*"%d %-5p %X{one} %X{foo} %X{bar} %c{2} -
%m%n"*/>

      <Policies>

                <SizeBasedTriggeringPolicy size=*"50 KB"* />

        </Policies>

        <DefaultRolloverStrategy fileIndex=*"min"* max=*"50"*/>

    </RollingFile>

    <Console name=*"STDOUT"* target=*"SYSTEM_OUT"*>

      <PatternLayout pattern=*"%d %-5p %X{one} %X{foo} %X{bar} %c{2} -
%m%n"*/>

    </Console>

  </Appenders>

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