You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Arnold Morein <ar...@me.com.INVALID> on 2018/08/21 15:54:40 UTC

Log4j2 files only have 2h of data

I have an application that used to be using logback APIs and is now on log4j2. It has several log files configured like this:



<RollingFile
    name="XYZ_LOGGER"
    fileName="${logBaseDir}/${hostName}_XZY.log"
    filePattern="${logBaseDir}/rotated/${hostName}_XZY.%d.log.gz"
>
    <PatternLayout pattern="${patternStr}" />
    <Policies>
        <OnStartupTriggeringPolicy />
        <SizeBasedTriggeringPolicy size="${maxFileSize}" />
    </Policies>
</RollingFile>


No matter how busy the given log is (some of which are very busy) only the last two hours of data are present in the current file.



Is there some configuration item I have wrong? Or some buffering thing I don't know about?

Re: Log4j2 files only have 2h of data

Posted by Matt Sicker <bo...@gmail.com>.
Your pattern is using %d which is the day of month. You want to use %i
which is an integer counter.

On Tue, 21 Aug 2018 at 10:55, Arnold Morein <ar...@me.com.invalid>
wrote:

> I have an application that used to be using logback APIs and is now on
> log4j2. It has several log files configured like this:
>
> <RollingFile
>     name="XYZ_LOGGER"
>     fileName="${logBaseDir}/${hostName}_XZY.log"
>     filePattern="${logBaseDir}/rotated/${hostName}_XZY.%d.log.gz"
> >
>     <PatternLayout pattern="${patternStr}" />
>     <Policies>
>         <OnStartupTriggeringPolicy />
>         <SizeBasedTriggeringPolicy size="${maxFileSize}" />
>     </Policies>
> </RollingFile>
>
> No matter how busy the given log is (some of which are very busy) only the
> last two hours of data are present in the current file.
>
> Is there some configuration item I have wrong? Or some buffering thing I
> don't know about?
>


-- 
Matt Sicker <bo...@gmail.com>