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 Richard Kolb <rj...@gmail.com> on 2015/03/24 09:12:17 UTC

Intermittent log file compression issue

Hello,

I am using log4j 2.2 on Windows 2008 using Java 7 and I'm experiencing an
intermittent issue where my log files used to compress, but now just move
to the archive directory uncompressed.

To debug, I changed the file pattern to be on the minute level (in bold),
and I am getting the same issue

Any help would be greatly be appreciated..

thanks,
Richard.

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="TRACE" name="API" packages=""  monitorInterval="30">
    <Appenders>
    <RollingRandomAccessFile name="CatchAll" fileName="logs/all.log"
immediateFlush="false" append="true"
FilePattern="logs/$${date:yyyy-MM}/all-%d{yyyy-MM-dd}-%i.log.gz">
      <PatternLayout>
        <Pattern>%d %m%n</Pattern>
      </PatternLayout>
            <Policies>
                <TimeBasedTriggeringPolicy interval="1" modulate="true" />
                <SizeBasedTriggeringPolicy size="2 GB"/>
            </Policies>
            <DefaultRolloverStrategy max="20"/>
    </RollingRandomAccessFile>
    <RollingRandomAccessFile name="Audit" fileName="logs/audit.log"
immediateFlush="false" append="true"
FilePattern="logs/$${date:yyyy-MM}/audit-%d{yyyy-MM-dd_hh_mm}-%i.log.gz">
      <PatternLayout>
        <Pattern>%d %m%n</Pattern>
      </PatternLayout>
            <Policies>
                <TimeBasedTriggeringPolicy interval="1" modulate="true" />
                <SizeBasedTriggeringPolicy size="2 GB"/>
            </Policies>
            <DefaultRolloverStrategy max="20"/>
    </RollingRandomAccessFile>
    <RollingRandomAccessFile name="Fault" fileName="logs/fault.log"
immediateFlush="false" append="true" FilePattern="
*logs/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd_hh_mm}-%i.log.gz*">
      <PatternLayout>
        <Pattern>%d %m%n</Pattern>
      </PatternLayout>
            <Policies>
                <TimeBasedTriggeringPolicy interval="1" modulate="true" />
                <SizeBasedTriggeringPolicy size="2 GB"/>
            </Policies>
            <DefaultRolloverStrategy max="20"/>
    </RollingRandomAccessFile>


   <RollingRandomAccessFile name="LegacyAudit"
fileName="logs/webservices.log" immediateFlush="false" append="true"
FilePattern="
*logs/$${date:yyyy-MM}/webservices-%d{yyyy-MM-dd_hh_mm}-%i.log.gz*">
      <PatternLayout>
        <Pattern>%d %m%n</Pattern>
      </PatternLayout>
            <Policies>
                <TimeBasedTriggeringPolicy interval="1" modulate="true" />
                <SizeBasedTriggeringPolicy size="2 GB"/>
            </Policies>
            <DefaultRolloverStrategy max="20"/>
    </RollingRandomAccessFile>



    </Appenders>
<!-- Don't forget to set system property for Async
-DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
     to make all loggers asynchronous. -->
    <Loggers>
        <Logger name="x.FcapsInterceptor" level="trace">
            <AppenderRef ref="Audit"/>
        </Logger>
        <Logger name="x.FcapsRpcInterceptor" level="trace">
            <AppenderRef ref="*LegacyAudit*"/>
        </Logger>

       <Logger name="x.Fault" level="trace">
            <AppenderRef ref="*Fault*"/>
        </Logger>
    <!--Root level="trace">
      <AppenderRef ref="CatchAll"/>
    </Root-->
    </Loggers>
</Configuration>

Re: Intermittent log file compression issue

Posted by Ralph Goers <ra...@dslextreme.com>.
Yes, that is the correct answer.  As a matter of course you should never cause a file to be open for write from a) multiple web applications or b) multiple processes without using file locking. Note that RollingFileAppender clearly says it does not support file locking - there are just too many issues with it when trying to roll the files from multiple web apps or containers.

Ralph

> On Mar 25, 2015, at 9:01 AM, Richard Kolb <rj...@gmail.com> wrote:
> 
> Sorry, probably a silly question.
> 
> The answer is drop log4j2 in the containers lib :)
> 
> Regards,
> Richard
> On 25 Mar 2015 17:20, "Richard Kolb" <rj...@gmail.com> wrote:
> 
>> Hi Remko,
>> 
>> Just a quick question.
>> I assume one global log4j2.xml in a container is a bad idea then. Assuming
>> that the apps that log are in separate classloaders.
>> 
>> Thanks.
>> Richard.
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Intermittent log file compression issue

Posted by Richard Kolb <rj...@gmail.com>.
Sorry, probably a silly question.

The answer is drop log4j2 in the containers lib :)

Regards,
Richard
On 25 Mar 2015 17:20, "Richard Kolb" <rj...@gmail.com> wrote:

> Hi Remko,
>
> Just a quick question.
> I assume one global log4j2.xml in a container is a bad idea then. Assuming
> that the apps that log are in separate classloaders.
>
> Thanks.
> Richard.
>

Re: Intermittent log file compression issue

Posted by Richard Kolb <rj...@gmail.com>.
Hi Remko,

Just a quick question.
I assume one global log4j2.xml in a container is a bad idea then. Assuming
that the apps that log are in separate classloaders.

Thanks.
Richard.

Re: Intermittent log file compression issue

Posted by Remko Popma <re...@gmail.com>.
Great! Glad to hear that the problem is resolved.
-Remko

On Wed, Mar 25, 2015 at 10:30 PM, Richard Kolb <rj...@gmail.com> wrote:

> Hi Remko,
>
> Seems I found the issue.
>
> I have two Web apps in the same container that use the same log4j2.xml and
> they are in different class loaders.
> I misread the docs and assumed it would work.
>
> I am guessing there is a race condition where the one application is
> writing while the other tries to archive.
>
> Does that make sense?
>
> Regards,
> Richard.
> On 25 Mar 2015 12:39, "Richard Kolb" <rj...@gmail.com> wrote:
>
> > Hi Remko.
> >
> > Another symptom is that the log files are not cleared on the daily
> > archive.
> >
> > I.e I started the server on Friday morning and it logs to audit.log and
> it
> > archives daily.
> > The audit.log file now contains all the logs since Friday and it not
> > cleared.
> > The archived logs also contain all the logs to the point they were
> > archived.
> >
> > Regards,
> > Richard.
> > On 25 Mar 2015 09:20, "Richard Kolb" <rj...@gmail.com> wrote:
> >
> >> Hi Remko
> >>
> >> On 25 March 2015 at 04:21, Remko Popma <re...@gmail.com> wrote:
> >>
> >>> So, if you specify the config location with system property
> >>> "log4j.configurationFile" then old log files are compressed correctly
> on
> >>> rollover, correct?
> >>>
> >>
> >> Correct.
> >> I specify with the parameter
> -Dlog4j.configurationFile=file:../log4j2.xml
> >> When I did my tests on the command line I specified an absolute path to
> >> log4j2.xml
> >>
> >> See the attached screen shot of the logs that got archived and then
> >> suddenly not.
> >> I specified the log paths and gzip paths as an absolute directory.
> >>
> >> 1) This file got gzipped :
> >>
> >>   *2015-03-25 08:55:37,315 DEBUG RollingFileManager executing
> >> synchronous FileRenameAction[C:\usr\local\applications\work*
> *-api\domain\work-api\logs\audit.log
> >> to
> C:\usr\local\applications\work-api\domain\work-api\logs\2015-03\aud*
> *it-2015-03-25_08_54-1.log,
> >> renameEmptyFiles=false]*  *2015-03-25 08:55:37,315 DEBUG
> >> RollingFileManager executing async
> >> GzCompressAction[C:\usr\local\applications\work-api*
> *\domain\work-api\logs\2015-03\audit-2015-03-25_08_54-1.log
> >> to C:\usr\local\applications\work-api\domain\work*
> *-api\logs\2015-03\audit-2015-03-25_08_54-1.log.gz,
> >> deleteSource=true]*
> >>
> >> 2) This one did the move but not the gzip
> >>
> >>   *2015-03-25 08:56:05,817 TRACE PatternProcessor.getNextTime returning
> >> 2015/03/25-08:57:00.000, nextFileTime=2015/03/25-08*  *:56:00.000,
> >> prevFileTime=2015/03/25-08:55:00.000, current=2015/03/25-08:56:05.817,
> >> freq=EVERY_MINUTE*  *2015-03-25 08:56:05,832 TRACE
> >> DefaultRolloverStrategy.purge() took 0.004088928 seconds*  *2015-03-25
> >> 08:56:05,832 DEBUG RollingFileManager executing synchronous
> >> FileRenameAction[C:\usr\local\applications\work*
> *-api\domain\work-api\logs\audit.log
> >> to
> C:\usr\local\applications\work-api\domain\work-api\logs\2015-03\aud*
> *it-2015-03-25_08_55-1.log,
> >> renameEmptyFiles=false]*
> >> It seems the GzCompressAction log never comes up.
> >>
> >>
> >>
> >>> If you include the config file in your application jar and rely on the
> >>> classpath then what happens? Is rollover the only thing that breaks?
> >>>
> >>
> >> I have not tried this yet. I will do that now.
> >>
> >>
> >>>
> >>> In the latter case, have you tried an absolute path?
> >>> (You can use an env: or sys: lookup to make the absolute path prefix
> >>> configurable, for example
> >>>
> filePath="${sys:logdir}/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd_hh_mm}-%i.log.gz"
> >>> where the value of system property "logdir" is an absolute path.)
> >>>
> >>
> >> Thanks, yes I did this in the above tests.
> >>
> >> regards,
> >> Richard.
> >>
> >>
> >>
> >>>
> >>> Sent from my iPhone
> >>>
> >>> > On 2015/03/24, at 23:42, Richard Kolb <rj...@gmail.com> wrote:
> >>> >
> >>> > Hi Remko,
> >>> >
> >>> > Thanks, very much.
> >>> > Changing FilePattern to filePattern did not solve the issue.
> >>> > The * was an typeo in the email, sorry for that.
> >>> >
> >>> > I am still experiencing the same issue inside the container and I
> can't
> >>> > recreate the issue with the same log4j2.xml outside the container.
> >>> >
> >>> > Next step is to check the log4j2 fine logs and I will report back.
> >>> >
> >>> > Regards,
> >>> > Richard.
> >>> > Can you try filePattern with a lower-case 'f' and remove the '*'
> >>> characters
> >>> > from the filePattern path?
> >>> >
> >>> > For example:
> >>> >> FilePattern="
> >>> >> *logs/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd_hh_mm}-%i.log.gz*"
> >>> >
> >>> >
> >>> > Should be
> >>> >> filePattern="
> >>> >> logs/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd_hh_mm}-%i.log.gz"
> >>> >
> >>> >
> >>> > Regards,
> >>> > Remko
> >>> >
> >>> > Sent from my iPhone
> >>> >
> >>> >> On 2015/03/24, at 17:12, Richard Kolb <rj...@gmail.com> wrote:
> >>> >>
> >>> >> Hello,
> >>> >>
> >>> >> I am using log4j 2.2 on Windows 2008 using Java 7 and I'm
> >>> experiencing an
> >>> >> intermittent issue where my log files used to compress, but now just
> >>> move
> >>> >> to the archive directory uncompressed.
> >>> >>
> >>> >> To debug, I changed the file pattern to be on the minute level (in
> >>> bold),
> >>> >> and I am getting the same issue
> >>> >>
> >>> >> Any help would be greatly be appreciated..
> >>> >>
> >>> >> thanks,
> >>> >> Richard.
> >>> >>
> >>> >> <?xml version="1.0" encoding="UTF-8"?>
> >>> >> <Configuration status="TRACE" name="API" packages=""
> >>> > monitorInterval="30">
> >>> >>   <Appenders>
> >>> >>   <RollingRandomAccessFile name="CatchAll" fileName="logs/all.log"
> >>> >> immediateFlush="false" append="true"
> >>> >> FilePattern="logs/$${date:yyyy-MM}/all-%d{yyyy-MM-dd}-%i.log.gz">
> >>> >>     <PatternLayout>
> >>> >>       <Pattern>%d %m%n</Pattern>
> >>> >>     </PatternLayout>
> >>> >>           <Policies>
> >>> >>               <TimeBasedTriggeringPolicy interval="1"
> modulate="true"
> >>> />
> >>> >>               <SizeBasedTriggeringPolicy size="2 GB"/>
> >>> >>           </Policies>
> >>> >>           <DefaultRolloverStrategy max="20"/>
> >>> >>   </RollingRandomAccessFile>
> >>> >>   <RollingRandomAccessFile name="Audit" fileName="logs/audit.log"
> >>> >> immediateFlush="false" append="true"
> >>> >>
> >>>
> FilePattern="logs/$${date:yyyy-MM}/audit-%d{yyyy-MM-dd_hh_mm}-%i.log.gz">
> >>> >>     <PatternLayout>
> >>> >>       <Pattern>%d %m%n</Pattern>
> >>> >>     </PatternLayout>
> >>> >>           <Policies>
> >>> >>               <TimeBasedTriggeringPolicy interval="1"
> modulate="true"
> >>> />
> >>> >>               <SizeBasedTriggeringPolicy size="2 GB"/>
> >>> >>           </Policies>
> >>> >>           <DefaultRolloverStrategy max="20"/>
> >>> >>   </RollingRandomAccessFile>
> >>> >>   <RollingRandomAccessFile name="Fault" fileName="logs/fault.log"
> >>> >> immediateFlush="false" append="true" FilePattern="
> >>> >> *logs/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd_hh_mm}-%i.log.gz*">
> >>> >>     <PatternLayout>
> >>> >>       <Pattern>%d %m%n</Pattern>
> >>> >>     </PatternLayout>
> >>> >>           <Policies>
> >>> >>               <TimeBasedTriggeringPolicy interval="1"
> modulate="true"
> >>> />
> >>> >>               <SizeBasedTriggeringPolicy size="2 GB"/>
> >>> >>           </Policies>
> >>> >>           <DefaultRolloverStrategy max="20"/>
> >>> >>   </RollingRandomAccessFile>
> >>> >>
> >>> >>
> >>> >>  <RollingRandomAccessFile name="LegacyAudit"
> >>> >> fileName="logs/webservices.log" immediateFlush="false" append="true"
> >>> >> FilePattern="
> >>> >> *logs/$${date:yyyy-MM}/webservices-%d{yyyy-MM-dd_hh_mm}-%i.log.gz*">
> >>> >>     <PatternLayout>
> >>> >>       <Pattern>%d %m%n</Pattern>
> >>> >>     </PatternLayout>
> >>> >>           <Policies>
> >>> >>               <TimeBasedTriggeringPolicy interval="1"
> modulate="true"
> >>> />
> >>> >>               <SizeBasedTriggeringPolicy size="2 GB"/>
> >>> >>           </Policies>
> >>> >>           <DefaultRolloverStrategy max="20"/>
> >>> >>   </RollingRandomAccessFile>
> >>> >>
> >>> >>
> >>> >>
> >>> >>   </Appenders>
> >>> >> <!-- Don't forget to set system property for Async
> >>> >
> >>>
> -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
> >>> >>    to make all loggers asynchronous. -->
> >>> >>   <Loggers>
> >>> >>       <Logger name="x.FcapsInterceptor" level="trace">
> >>> >>           <AppenderRef ref="Audit"/>
> >>> >>       </Logger>
> >>> >>       <Logger name="x.FcapsRpcInterceptor" level="trace">
> >>> >>           <AppenderRef ref="*LegacyAudit*"/>
> >>> >>       </Logger>
> >>> >>
> >>> >>      <Logger name="x.Fault" level="trace">
> >>> >>           <AppenderRef ref="*Fault*"/>
> >>> >>       </Logger>
> >>> >>   <!--Root level="trace">
> >>> >>     <AppenderRef ref="CatchAll"/>
> >>> >>   </Root-->
> >>> >>   </Loggers>
> >>> >> </Configuration>
> >>> >
> >>> > ---------------------------------------------------------------------
> >>> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> >>> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> >>> For additional commands, e-mail: log4j-user-help@logging.apache.org
> >>>
> >>>
> >>
>

Re: Intermittent log file compression issue

Posted by Richard Kolb <rj...@gmail.com>.
Hi Remko,

Seems I found the issue.

I have two Web apps in the same container that use the same log4j2.xml and
they are in different class loaders.
I misread the docs and assumed it would work.

I am guessing there is a race condition where the one application is
writing while the other tries to archive.

Does that make sense?

Regards,
Richard.
On 25 Mar 2015 12:39, "Richard Kolb" <rj...@gmail.com> wrote:

> Hi Remko.
>
> Another symptom is that the log files are not cleared on the daily
> archive.
>
> I.e I started the server on Friday morning and it logs to audit.log and it
> archives daily.
> The audit.log file now contains all the logs since Friday and it not
> cleared.
> The archived logs also contain all the logs to the point they were
> archived.
>
> Regards,
> Richard.
> On 25 Mar 2015 09:20, "Richard Kolb" <rj...@gmail.com> wrote:
>
>> Hi Remko
>>
>> On 25 March 2015 at 04:21, Remko Popma <re...@gmail.com> wrote:
>>
>>> So, if you specify the config location with system property
>>> "log4j.configurationFile" then old log files are compressed correctly on
>>> rollover, correct?
>>>
>>
>> Correct.
>> I specify with the parameter  -Dlog4j.configurationFile=file:../log4j2.xml
>> When I did my tests on the command line I specified an absolute path to
>> log4j2.xml
>>
>> See the attached screen shot of the logs that got archived and then
>> suddenly not.
>> I specified the log paths and gzip paths as an absolute directory.
>>
>> 1) This file got gzipped :
>>
>>   *2015-03-25 08:55:37,315 DEBUG RollingFileManager executing
>> synchronous FileRenameAction[C:\usr\local\applications\work*  *-api\domain\work-api\logs\audit.log
>> to C:\usr\local\applications\work-api\domain\work-api\logs\2015-03\aud*  *it-2015-03-25_08_54-1.log,
>> renameEmptyFiles=false]*  *2015-03-25 08:55:37,315 DEBUG
>> RollingFileManager executing async
>> GzCompressAction[C:\usr\local\applications\work-api*  *\domain\work-api\logs\2015-03\audit-2015-03-25_08_54-1.log
>> to C:\usr\local\applications\work-api\domain\work*  *-api\logs\2015-03\audit-2015-03-25_08_54-1.log.gz,
>> deleteSource=true]*
>>
>> 2) This one did the move but not the gzip
>>
>>   *2015-03-25 08:56:05,817 TRACE PatternProcessor.getNextTime returning
>> 2015/03/25-08:57:00.000, nextFileTime=2015/03/25-08*  *:56:00.000,
>> prevFileTime=2015/03/25-08:55:00.000, current=2015/03/25-08:56:05.817,
>> freq=EVERY_MINUTE*  *2015-03-25 08:56:05,832 TRACE
>> DefaultRolloverStrategy.purge() took 0.004088928 seconds*  *2015-03-25
>> 08:56:05,832 DEBUG RollingFileManager executing synchronous
>> FileRenameAction[C:\usr\local\applications\work*  *-api\domain\work-api\logs\audit.log
>> to C:\usr\local\applications\work-api\domain\work-api\logs\2015-03\aud*  *it-2015-03-25_08_55-1.log,
>> renameEmptyFiles=false]*
>> It seems the GzCompressAction log never comes up.
>>
>>
>>
>>> If you include the config file in your application jar and rely on the
>>> classpath then what happens? Is rollover the only thing that breaks?
>>>
>>
>> I have not tried this yet. I will do that now.
>>
>>
>>>
>>> In the latter case, have you tried an absolute path?
>>> (You can use an env: or sys: lookup to make the absolute path prefix
>>> configurable, for example
>>> filePath="${sys:logdir}/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd_hh_mm}-%i.log.gz"
>>> where the value of system property "logdir" is an absolute path.)
>>>
>>
>> Thanks, yes I did this in the above tests.
>>
>> regards,
>> Richard.
>>
>>
>>
>>>
>>> Sent from my iPhone
>>>
>>> > On 2015/03/24, at 23:42, Richard Kolb <rj...@gmail.com> wrote:
>>> >
>>> > Hi Remko,
>>> >
>>> > Thanks, very much.
>>> > Changing FilePattern to filePattern did not solve the issue.
>>> > The * was an typeo in the email, sorry for that.
>>> >
>>> > I am still experiencing the same issue inside the container and I can't
>>> > recreate the issue with the same log4j2.xml outside the container.
>>> >
>>> > Next step is to check the log4j2 fine logs and I will report back.
>>> >
>>> > Regards,
>>> > Richard.
>>> > Can you try filePattern with a lower-case 'f' and remove the '*'
>>> characters
>>> > from the filePattern path?
>>> >
>>> > For example:
>>> >> FilePattern="
>>> >> *logs/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd_hh_mm}-%i.log.gz*"
>>> >
>>> >
>>> > Should be
>>> >> filePattern="
>>> >> logs/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd_hh_mm}-%i.log.gz"
>>> >
>>> >
>>> > Regards,
>>> > Remko
>>> >
>>> > Sent from my iPhone
>>> >
>>> >> On 2015/03/24, at 17:12, Richard Kolb <rj...@gmail.com> wrote:
>>> >>
>>> >> Hello,
>>> >>
>>> >> I am using log4j 2.2 on Windows 2008 using Java 7 and I'm
>>> experiencing an
>>> >> intermittent issue where my log files used to compress, but now just
>>> move
>>> >> to the archive directory uncompressed.
>>> >>
>>> >> To debug, I changed the file pattern to be on the minute level (in
>>> bold),
>>> >> and I am getting the same issue
>>> >>
>>> >> Any help would be greatly be appreciated..
>>> >>
>>> >> thanks,
>>> >> Richard.
>>> >>
>>> >> <?xml version="1.0" encoding="UTF-8"?>
>>> >> <Configuration status="TRACE" name="API" packages=""
>>> > monitorInterval="30">
>>> >>   <Appenders>
>>> >>   <RollingRandomAccessFile name="CatchAll" fileName="logs/all.log"
>>> >> immediateFlush="false" append="true"
>>> >> FilePattern="logs/$${date:yyyy-MM}/all-%d{yyyy-MM-dd}-%i.log.gz">
>>> >>     <PatternLayout>
>>> >>       <Pattern>%d %m%n</Pattern>
>>> >>     </PatternLayout>
>>> >>           <Policies>
>>> >>               <TimeBasedTriggeringPolicy interval="1" modulate="true"
>>> />
>>> >>               <SizeBasedTriggeringPolicy size="2 GB"/>
>>> >>           </Policies>
>>> >>           <DefaultRolloverStrategy max="20"/>
>>> >>   </RollingRandomAccessFile>
>>> >>   <RollingRandomAccessFile name="Audit" fileName="logs/audit.log"
>>> >> immediateFlush="false" append="true"
>>> >>
>>> FilePattern="logs/$${date:yyyy-MM}/audit-%d{yyyy-MM-dd_hh_mm}-%i.log.gz">
>>> >>     <PatternLayout>
>>> >>       <Pattern>%d %m%n</Pattern>
>>> >>     </PatternLayout>
>>> >>           <Policies>
>>> >>               <TimeBasedTriggeringPolicy interval="1" modulate="true"
>>> />
>>> >>               <SizeBasedTriggeringPolicy size="2 GB"/>
>>> >>           </Policies>
>>> >>           <DefaultRolloverStrategy max="20"/>
>>> >>   </RollingRandomAccessFile>
>>> >>   <RollingRandomAccessFile name="Fault" fileName="logs/fault.log"
>>> >> immediateFlush="false" append="true" FilePattern="
>>> >> *logs/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd_hh_mm}-%i.log.gz*">
>>> >>     <PatternLayout>
>>> >>       <Pattern>%d %m%n</Pattern>
>>> >>     </PatternLayout>
>>> >>           <Policies>
>>> >>               <TimeBasedTriggeringPolicy interval="1" modulate="true"
>>> />
>>> >>               <SizeBasedTriggeringPolicy size="2 GB"/>
>>> >>           </Policies>
>>> >>           <DefaultRolloverStrategy max="20"/>
>>> >>   </RollingRandomAccessFile>
>>> >>
>>> >>
>>> >>  <RollingRandomAccessFile name="LegacyAudit"
>>> >> fileName="logs/webservices.log" immediateFlush="false" append="true"
>>> >> FilePattern="
>>> >> *logs/$${date:yyyy-MM}/webservices-%d{yyyy-MM-dd_hh_mm}-%i.log.gz*">
>>> >>     <PatternLayout>
>>> >>       <Pattern>%d %m%n</Pattern>
>>> >>     </PatternLayout>
>>> >>           <Policies>
>>> >>               <TimeBasedTriggeringPolicy interval="1" modulate="true"
>>> />
>>> >>               <SizeBasedTriggeringPolicy size="2 GB"/>
>>> >>           </Policies>
>>> >>           <DefaultRolloverStrategy max="20"/>
>>> >>   </RollingRandomAccessFile>
>>> >>
>>> >>
>>> >>
>>> >>   </Appenders>
>>> >> <!-- Don't forget to set system property for Async
>>> >
>>> -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
>>> >>    to make all loggers asynchronous. -->
>>> >>   <Loggers>
>>> >>       <Logger name="x.FcapsInterceptor" level="trace">
>>> >>           <AppenderRef ref="Audit"/>
>>> >>       </Logger>
>>> >>       <Logger name="x.FcapsRpcInterceptor" level="trace">
>>> >>           <AppenderRef ref="*LegacyAudit*"/>
>>> >>       </Logger>
>>> >>
>>> >>      <Logger name="x.Fault" level="trace">
>>> >>           <AppenderRef ref="*Fault*"/>
>>> >>       </Logger>
>>> >>   <!--Root level="trace">
>>> >>     <AppenderRef ref="CatchAll"/>
>>> >>   </Root-->
>>> >>   </Loggers>
>>> >> </Configuration>
>>> >
>>> > ---------------------------------------------------------------------
>>> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>> > For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>>
>>>
>>

Re: Intermittent log file compression issue

Posted by Richard Kolb <rj...@gmail.com>.
Hi Remko.

Another symptom is that the log files are not cleared on the daily archive.

I.e I started the server on Friday morning and it logs to audit.log and it
archives daily.
The audit.log file now contains all the logs since Friday and it not
cleared.
The archived logs also contain all the logs to the point they were archived.

Regards,
Richard.
On 25 Mar 2015 09:20, "Richard Kolb" <rj...@gmail.com> wrote:

> Hi Remko
>
> On 25 March 2015 at 04:21, Remko Popma <re...@gmail.com> wrote:
>
>> So, if you specify the config location with system property
>> "log4j.configurationFile" then old log files are compressed correctly on
>> rollover, correct?
>>
>
> Correct.
> I specify with the parameter  -Dlog4j.configurationFile=file:../log4j2.xml
> When I did my tests on the command line I specified an absolute path to
> log4j2.xml
>
> See the attached screen shot of the logs that got archived and then
> suddenly not.
> I specified the log paths and gzip paths as an absolute directory.
>
> 1) This file got gzipped :
>
>   *2015-03-25 08:55:37,315 DEBUG RollingFileManager executing synchronous
> FileRenameAction[C:\usr\local\applications\work*  *-api\domain\work-api\logs\audit.log
> to C:\usr\local\applications\work-api\domain\work-api\logs\2015-03\aud*  *it-2015-03-25_08_54-1.log,
> renameEmptyFiles=false]*  *2015-03-25 08:55:37,315 DEBUG
> RollingFileManager executing async
> GzCompressAction[C:\usr\local\applications\work-api*  *\domain\work-api\logs\2015-03\audit-2015-03-25_08_54-1.log
> to C:\usr\local\applications\work-api\domain\work*  *-api\logs\2015-03\audit-2015-03-25_08_54-1.log.gz,
> deleteSource=true]*
>
> 2) This one did the move but not the gzip
>
>   *2015-03-25 08:56:05,817 TRACE PatternProcessor.getNextTime returning
> 2015/03/25-08:57:00.000, nextFileTime=2015/03/25-08*  *:56:00.000,
> prevFileTime=2015/03/25-08:55:00.000, current=2015/03/25-08:56:05.817,
> freq=EVERY_MINUTE*  *2015-03-25 08:56:05,832 TRACE
> DefaultRolloverStrategy.purge() took 0.004088928 seconds*  *2015-03-25
> 08:56:05,832 DEBUG RollingFileManager executing synchronous
> FileRenameAction[C:\usr\local\applications\work*  *-api\domain\work-api\logs\audit.log
> to C:\usr\local\applications\work-api\domain\work-api\logs\2015-03\aud*  *it-2015-03-25_08_55-1.log,
> renameEmptyFiles=false]*
> It seems the GzCompressAction log never comes up.
>
>
>
>> If you include the config file in your application jar and rely on the
>> classpath then what happens? Is rollover the only thing that breaks?
>>
>
> I have not tried this yet. I will do that now.
>
>
>>
>> In the latter case, have you tried an absolute path?
>> (You can use an env: or sys: lookup to make the absolute path prefix
>> configurable, for example
>> filePath="${sys:logdir}/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd_hh_mm}-%i.log.gz"
>> where the value of system property "logdir" is an absolute path.)
>>
>
> Thanks, yes I did this in the above tests.
>
> regards,
> Richard.
>
>
>
>>
>> Sent from my iPhone
>>
>> > On 2015/03/24, at 23:42, Richard Kolb <rj...@gmail.com> wrote:
>> >
>> > Hi Remko,
>> >
>> > Thanks, very much.
>> > Changing FilePattern to filePattern did not solve the issue.
>> > The * was an typeo in the email, sorry for that.
>> >
>> > I am still experiencing the same issue inside the container and I can't
>> > recreate the issue with the same log4j2.xml outside the container.
>> >
>> > Next step is to check the log4j2 fine logs and I will report back.
>> >
>> > Regards,
>> > Richard.
>> > Can you try filePattern with a lower-case 'f' and remove the '*'
>> characters
>> > from the filePattern path?
>> >
>> > For example:
>> >> FilePattern="
>> >> *logs/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd_hh_mm}-%i.log.gz*"
>> >
>> >
>> > Should be
>> >> filePattern="
>> >> logs/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd_hh_mm}-%i.log.gz"
>> >
>> >
>> > Regards,
>> > Remko
>> >
>> > Sent from my iPhone
>> >
>> >> On 2015/03/24, at 17:12, Richard Kolb <rj...@gmail.com> wrote:
>> >>
>> >> Hello,
>> >>
>> >> I am using log4j 2.2 on Windows 2008 using Java 7 and I'm experiencing
>> an
>> >> intermittent issue where my log files used to compress, but now just
>> move
>> >> to the archive directory uncompressed.
>> >>
>> >> To debug, I changed the file pattern to be on the minute level (in
>> bold),
>> >> and I am getting the same issue
>> >>
>> >> Any help would be greatly be appreciated..
>> >>
>> >> thanks,
>> >> Richard.
>> >>
>> >> <?xml version="1.0" encoding="UTF-8"?>
>> >> <Configuration status="TRACE" name="API" packages=""
>> > monitorInterval="30">
>> >>   <Appenders>
>> >>   <RollingRandomAccessFile name="CatchAll" fileName="logs/all.log"
>> >> immediateFlush="false" append="true"
>> >> FilePattern="logs/$${date:yyyy-MM}/all-%d{yyyy-MM-dd}-%i.log.gz">
>> >>     <PatternLayout>
>> >>       <Pattern>%d %m%n</Pattern>
>> >>     </PatternLayout>
>> >>           <Policies>
>> >>               <TimeBasedTriggeringPolicy interval="1" modulate="true"
>> />
>> >>               <SizeBasedTriggeringPolicy size="2 GB"/>
>> >>           </Policies>
>> >>           <DefaultRolloverStrategy max="20"/>
>> >>   </RollingRandomAccessFile>
>> >>   <RollingRandomAccessFile name="Audit" fileName="logs/audit.log"
>> >> immediateFlush="false" append="true"
>> >>
>> FilePattern="logs/$${date:yyyy-MM}/audit-%d{yyyy-MM-dd_hh_mm}-%i.log.gz">
>> >>     <PatternLayout>
>> >>       <Pattern>%d %m%n</Pattern>
>> >>     </PatternLayout>
>> >>           <Policies>
>> >>               <TimeBasedTriggeringPolicy interval="1" modulate="true"
>> />
>> >>               <SizeBasedTriggeringPolicy size="2 GB"/>
>> >>           </Policies>
>> >>           <DefaultRolloverStrategy max="20"/>
>> >>   </RollingRandomAccessFile>
>> >>   <RollingRandomAccessFile name="Fault" fileName="logs/fault.log"
>> >> immediateFlush="false" append="true" FilePattern="
>> >> *logs/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd_hh_mm}-%i.log.gz*">
>> >>     <PatternLayout>
>> >>       <Pattern>%d %m%n</Pattern>
>> >>     </PatternLayout>
>> >>           <Policies>
>> >>               <TimeBasedTriggeringPolicy interval="1" modulate="true"
>> />
>> >>               <SizeBasedTriggeringPolicy size="2 GB"/>
>> >>           </Policies>
>> >>           <DefaultRolloverStrategy max="20"/>
>> >>   </RollingRandomAccessFile>
>> >>
>> >>
>> >>  <RollingRandomAccessFile name="LegacyAudit"
>> >> fileName="logs/webservices.log" immediateFlush="false" append="true"
>> >> FilePattern="
>> >> *logs/$${date:yyyy-MM}/webservices-%d{yyyy-MM-dd_hh_mm}-%i.log.gz*">
>> >>     <PatternLayout>
>> >>       <Pattern>%d %m%n</Pattern>
>> >>     </PatternLayout>
>> >>           <Policies>
>> >>               <TimeBasedTriggeringPolicy interval="1" modulate="true"
>> />
>> >>               <SizeBasedTriggeringPolicy size="2 GB"/>
>> >>           </Policies>
>> >>           <DefaultRolloverStrategy max="20"/>
>> >>   </RollingRandomAccessFile>
>> >>
>> >>
>> >>
>> >>   </Appenders>
>> >> <!-- Don't forget to set system property for Async
>> >
>> -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
>> >>    to make all loggers asynchronous. -->
>> >>   <Loggers>
>> >>       <Logger name="x.FcapsInterceptor" level="trace">
>> >>           <AppenderRef ref="Audit"/>
>> >>       </Logger>
>> >>       <Logger name="x.FcapsRpcInterceptor" level="trace">
>> >>           <AppenderRef ref="*LegacyAudit*"/>
>> >>       </Logger>
>> >>
>> >>      <Logger name="x.Fault" level="trace">
>> >>           <AppenderRef ref="*Fault*"/>
>> >>       </Logger>
>> >>   <!--Root level="trace">
>> >>     <AppenderRef ref="CatchAll"/>
>> >>   </Root-->
>> >>   </Loggers>
>> >> </Configuration>
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> > For additional commands, e-mail: log4j-user-help@logging.apache.org
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>
>>
>

Re: Intermittent log file compression issue

Posted by Richard Kolb <rj...@gmail.com>.
Hi Remko

On 25 March 2015 at 04:21, Remko Popma <re...@gmail.com> wrote:

> So, if you specify the config location with system property
> "log4j.configurationFile" then old log files are compressed correctly on
> rollover, correct?
>

Correct.
I specify with the parameter  -Dlog4j.configurationFile=file:../log4j2.xml
When I did my tests on the command line I specified an absolute path to
log4j2.xml

See the attached screen shot of the logs that got archived and then
suddenly not.
I specified the log paths and gzip paths as an absolute directory.

1) This file got gzipped :

  *2015-03-25 08:55:37,315 DEBUG RollingFileManager executing synchronous
FileRenameAction[C:\usr\local\applications\work*
*-api\domain\work-api\logs\audit.log
to C:\usr\local\applications\work-api\domain\work-api\logs\2015-03\aud*
 *it-2015-03-25_08_54-1.log,
renameEmptyFiles=false]*  *2015-03-25 08:55:37,315 DEBUG RollingFileManager
executing async GzCompressAction[C:\usr\local\applications\work-api*
*\domain\work-api\logs\2015-03\audit-2015-03-25_08_54-1.log
to C:\usr\local\applications\work-api\domain\work*
*-api\logs\2015-03\audit-2015-03-25_08_54-1.log.gz,
deleteSource=true]*

2) This one did the move but not the gzip

  *2015-03-25 08:56:05,817 TRACE PatternProcessor.getNextTime returning
2015/03/25-08:57:00.000, nextFileTime=2015/03/25-08*  *:56:00.000,
prevFileTime=2015/03/25-08:55:00.000, current=2015/03/25-08:56:05.817,
freq=EVERY_MINUTE*  *2015-03-25 08:56:05,832 TRACE
DefaultRolloverStrategy.purge() took 0.004088928 seconds*  *2015-03-25
08:56:05,832 DEBUG RollingFileManager executing synchronous
FileRenameAction[C:\usr\local\applications\work*
*-api\domain\work-api\logs\audit.log
to C:\usr\local\applications\work-api\domain\work-api\logs\2015-03\aud*
 *it-2015-03-25_08_55-1.log,
renameEmptyFiles=false]*
It seems the GzCompressAction log never comes up.



> If you include the config file in your application jar and rely on the
> classpath then what happens? Is rollover the only thing that breaks?
>

I have not tried this yet. I will do that now.


>
> In the latter case, have you tried an absolute path?
> (You can use an env: or sys: lookup to make the absolute path prefix
> configurable, for example
> filePath="${sys:logdir}/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd_hh_mm}-%i.log.gz"
> where the value of system property "logdir" is an absolute path.)
>

Thanks, yes I did this in the above tests.

regards,
Richard.



>
> Sent from my iPhone
>
> > On 2015/03/24, at 23:42, Richard Kolb <rj...@gmail.com> wrote:
> >
> > Hi Remko,
> >
> > Thanks, very much.
> > Changing FilePattern to filePattern did not solve the issue.
> > The * was an typeo in the email, sorry for that.
> >
> > I am still experiencing the same issue inside the container and I can't
> > recreate the issue with the same log4j2.xml outside the container.
> >
> > Next step is to check the log4j2 fine logs and I will report back.
> >
> > Regards,
> > Richard.
> > Can you try filePattern with a lower-case 'f' and remove the '*'
> characters
> > from the filePattern path?
> >
> > For example:
> >> FilePattern="
> >> *logs/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd_hh_mm}-%i.log.gz*"
> >
> >
> > Should be
> >> filePattern="
> >> logs/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd_hh_mm}-%i.log.gz"
> >
> >
> > Regards,
> > Remko
> >
> > Sent from my iPhone
> >
> >> On 2015/03/24, at 17:12, Richard Kolb <rj...@gmail.com> wrote:
> >>
> >> Hello,
> >>
> >> I am using log4j 2.2 on Windows 2008 using Java 7 and I'm experiencing
> an
> >> intermittent issue where my log files used to compress, but now just
> move
> >> to the archive directory uncompressed.
> >>
> >> To debug, I changed the file pattern to be on the minute level (in
> bold),
> >> and I am getting the same issue
> >>
> >> Any help would be greatly be appreciated..
> >>
> >> thanks,
> >> Richard.
> >>
> >> <?xml version="1.0" encoding="UTF-8"?>
> >> <Configuration status="TRACE" name="API" packages=""
> > monitorInterval="30">
> >>   <Appenders>
> >>   <RollingRandomAccessFile name="CatchAll" fileName="logs/all.log"
> >> immediateFlush="false" append="true"
> >> FilePattern="logs/$${date:yyyy-MM}/all-%d{yyyy-MM-dd}-%i.log.gz">
> >>     <PatternLayout>
> >>       <Pattern>%d %m%n</Pattern>
> >>     </PatternLayout>
> >>           <Policies>
> >>               <TimeBasedTriggeringPolicy interval="1" modulate="true" />
> >>               <SizeBasedTriggeringPolicy size="2 GB"/>
> >>           </Policies>
> >>           <DefaultRolloverStrategy max="20"/>
> >>   </RollingRandomAccessFile>
> >>   <RollingRandomAccessFile name="Audit" fileName="logs/audit.log"
> >> immediateFlush="false" append="true"
> >>
> FilePattern="logs/$${date:yyyy-MM}/audit-%d{yyyy-MM-dd_hh_mm}-%i.log.gz">
> >>     <PatternLayout>
> >>       <Pattern>%d %m%n</Pattern>
> >>     </PatternLayout>
> >>           <Policies>
> >>               <TimeBasedTriggeringPolicy interval="1" modulate="true" />
> >>               <SizeBasedTriggeringPolicy size="2 GB"/>
> >>           </Policies>
> >>           <DefaultRolloverStrategy max="20"/>
> >>   </RollingRandomAccessFile>
> >>   <RollingRandomAccessFile name="Fault" fileName="logs/fault.log"
> >> immediateFlush="false" append="true" FilePattern="
> >> *logs/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd_hh_mm}-%i.log.gz*">
> >>     <PatternLayout>
> >>       <Pattern>%d %m%n</Pattern>
> >>     </PatternLayout>
> >>           <Policies>
> >>               <TimeBasedTriggeringPolicy interval="1" modulate="true" />
> >>               <SizeBasedTriggeringPolicy size="2 GB"/>
> >>           </Policies>
> >>           <DefaultRolloverStrategy max="20"/>
> >>   </RollingRandomAccessFile>
> >>
> >>
> >>  <RollingRandomAccessFile name="LegacyAudit"
> >> fileName="logs/webservices.log" immediateFlush="false" append="true"
> >> FilePattern="
> >> *logs/$${date:yyyy-MM}/webservices-%d{yyyy-MM-dd_hh_mm}-%i.log.gz*">
> >>     <PatternLayout>
> >>       <Pattern>%d %m%n</Pattern>
> >>     </PatternLayout>
> >>           <Policies>
> >>               <TimeBasedTriggeringPolicy interval="1" modulate="true" />
> >>               <SizeBasedTriggeringPolicy size="2 GB"/>
> >>           </Policies>
> >>           <DefaultRolloverStrategy max="20"/>
> >>   </RollingRandomAccessFile>
> >>
> >>
> >>
> >>   </Appenders>
> >> <!-- Don't forget to set system property for Async
> >
> -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
> >>    to make all loggers asynchronous. -->
> >>   <Loggers>
> >>       <Logger name="x.FcapsInterceptor" level="trace">
> >>           <AppenderRef ref="Audit"/>
> >>       </Logger>
> >>       <Logger name="x.FcapsRpcInterceptor" level="trace">
> >>           <AppenderRef ref="*LegacyAudit*"/>
> >>       </Logger>
> >>
> >>      <Logger name="x.Fault" level="trace">
> >>           <AppenderRef ref="*Fault*"/>
> >>       </Logger>
> >>   <!--Root level="trace">
> >>     <AppenderRef ref="CatchAll"/>
> >>   </Root-->
> >>   </Loggers>
> >> </Configuration>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>

Re: Intermittent log file compression issue

Posted by Remko Popma <re...@gmail.com>.
Richard,

So, if you specify the config location with system property "log4j.configurationFile" then old log files are compressed correctly on rollover, correct?

If you include the config file in your application jar and rely on the classpath then what happens? Is rollover the only thing that breaks?

In the latter case, have you tried an absolute path?
(You can use an env: or sys: lookup to make the absolute path prefix configurable, for example filePath="${sys:logdir}/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd_hh_mm}-%i.log.gz" where the value of system property "logdir" is an absolute path.)

Sent from my iPhone

> On 2015/03/24, at 23:42, Richard Kolb <rj...@gmail.com> wrote:
> 
> Hi Remko,
> 
> Thanks, very much.
> Changing FilePattern to filePattern did not solve the issue.
> The * was an typeo in the email, sorry for that.
> 
> I am still experiencing the same issue inside the container and I can't
> recreate the issue with the same log4j2.xml outside the container.
> 
> Next step is to check the log4j2 fine logs and I will report back.
> 
> Regards,
> Richard.
> Can you try filePattern with a lower-case 'f' and remove the '*' characters
> from the filePattern path?
> 
> For example:
>> FilePattern="
>> *logs/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd_hh_mm}-%i.log.gz*"
> 
> 
> Should be
>> filePattern="
>> logs/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd_hh_mm}-%i.log.gz"
> 
> 
> Regards,
> Remko
> 
> Sent from my iPhone
> 
>> On 2015/03/24, at 17:12, Richard Kolb <rj...@gmail.com> wrote:
>> 
>> Hello,
>> 
>> I am using log4j 2.2 on Windows 2008 using Java 7 and I'm experiencing an
>> intermittent issue where my log files used to compress, but now just move
>> to the archive directory uncompressed.
>> 
>> To debug, I changed the file pattern to be on the minute level (in bold),
>> and I am getting the same issue
>> 
>> Any help would be greatly be appreciated..
>> 
>> thanks,
>> Richard.
>> 
>> <?xml version="1.0" encoding="UTF-8"?>
>> <Configuration status="TRACE" name="API" packages=""
> monitorInterval="30">
>>   <Appenders>
>>   <RollingRandomAccessFile name="CatchAll" fileName="logs/all.log"
>> immediateFlush="false" append="true"
>> FilePattern="logs/$${date:yyyy-MM}/all-%d{yyyy-MM-dd}-%i.log.gz">
>>     <PatternLayout>
>>       <Pattern>%d %m%n</Pattern>
>>     </PatternLayout>
>>           <Policies>
>>               <TimeBasedTriggeringPolicy interval="1" modulate="true" />
>>               <SizeBasedTriggeringPolicy size="2 GB"/>
>>           </Policies>
>>           <DefaultRolloverStrategy max="20"/>
>>   </RollingRandomAccessFile>
>>   <RollingRandomAccessFile name="Audit" fileName="logs/audit.log"
>> immediateFlush="false" append="true"
>> FilePattern="logs/$${date:yyyy-MM}/audit-%d{yyyy-MM-dd_hh_mm}-%i.log.gz">
>>     <PatternLayout>
>>       <Pattern>%d %m%n</Pattern>
>>     </PatternLayout>
>>           <Policies>
>>               <TimeBasedTriggeringPolicy interval="1" modulate="true" />
>>               <SizeBasedTriggeringPolicy size="2 GB"/>
>>           </Policies>
>>           <DefaultRolloverStrategy max="20"/>
>>   </RollingRandomAccessFile>
>>   <RollingRandomAccessFile name="Fault" fileName="logs/fault.log"
>> immediateFlush="false" append="true" FilePattern="
>> *logs/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd_hh_mm}-%i.log.gz*">
>>     <PatternLayout>
>>       <Pattern>%d %m%n</Pattern>
>>     </PatternLayout>
>>           <Policies>
>>               <TimeBasedTriggeringPolicy interval="1" modulate="true" />
>>               <SizeBasedTriggeringPolicy size="2 GB"/>
>>           </Policies>
>>           <DefaultRolloverStrategy max="20"/>
>>   </RollingRandomAccessFile>
>> 
>> 
>>  <RollingRandomAccessFile name="LegacyAudit"
>> fileName="logs/webservices.log" immediateFlush="false" append="true"
>> FilePattern="
>> *logs/$${date:yyyy-MM}/webservices-%d{yyyy-MM-dd_hh_mm}-%i.log.gz*">
>>     <PatternLayout>
>>       <Pattern>%d %m%n</Pattern>
>>     </PatternLayout>
>>           <Policies>
>>               <TimeBasedTriggeringPolicy interval="1" modulate="true" />
>>               <SizeBasedTriggeringPolicy size="2 GB"/>
>>           </Policies>
>>           <DefaultRolloverStrategy max="20"/>
>>   </RollingRandomAccessFile>
>> 
>> 
>> 
>>   </Appenders>
>> <!-- Don't forget to set system property for Async
> -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
>>    to make all loggers asynchronous. -->
>>   <Loggers>
>>       <Logger name="x.FcapsInterceptor" level="trace">
>>           <AppenderRef ref="Audit"/>
>>       </Logger>
>>       <Logger name="x.FcapsRpcInterceptor" level="trace">
>>           <AppenderRef ref="*LegacyAudit*"/>
>>       </Logger>
>> 
>>      <Logger name="x.Fault" level="trace">
>>           <AppenderRef ref="*Fault*"/>
>>       </Logger>
>>   <!--Root level="trace">
>>     <AppenderRef ref="CatchAll"/>
>>   </Root-->
>>   </Loggers>
>> </Configuration>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


RE: Intermittent log file compression issue

Posted by Mangat Rai <ma...@hotmail.com>.
I am also facing similar issue. log file compression never worked for me. i am using version 2.2
below is the configuration
<RollingRandomAccessFile name="Common" append="false" fileName="${logdir}\\Common\\common.log" filePattern="${logdir}\\Common\\$${date:yyyy-MM}\\common-%d{MM-dd-yyyy}-%i.log.gz">      <PatternLayout pattern="${layout}"/>      <Policies>        <TimeBasedTriggeringPolicy interval="1" modulate="true"/>        <SizeBasedTriggeringPolicy size="1 MB"/>      </Policies>      <DefaultRolloverStrategy max="10"/>    </RollingRandomAccessFile>
Any pointer?
Regards,Mangat Rai


> Date: Tue, 24 Mar 2015 16:42:15 +0200
> Subject: Re: Intermittent log file compression issue
> From: rjdkolb@gmail.com
> To: log4j-user@logging.apache.org
> 
> Hi Remko,
> 
> Thanks, very much.
> Changing FilePattern to filePattern did not solve the issue.
> The * was an typeo in the email, sorry for that.
> 
> I am still experiencing the same issue inside the container and I can't
> recreate the issue with the same log4j2.xml outside the container.
> 
> Next step is to check the log4j2 fine logs and I will report back.
> 
> Regards,
> Richard.
> Can you try filePattern with a lower-case 'f' and remove the '*' characters
> from the filePattern path?
> 
> For example:
> > FilePattern="
> > *logs/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd_hh_mm}-%i.log.gz*"
> 
> 
> Should be
> > filePattern="
> > logs/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd_hh_mm}-%i.log.gz"
> 
> 
> Regards,
> Remko
> 
> Sent from my iPhone
> 
> > On 2015/03/24, at 17:12, Richard Kolb <rj...@gmail.com> wrote:
> >
> > Hello,
> >
> > I am using log4j 2.2 on Windows 2008 using Java 7 and I'm experiencing an
> > intermittent issue where my log files used to compress, but now just move
> > to the archive directory uncompressed.
> >
> > To debug, I changed the file pattern to be on the minute level (in bold),
> > and I am getting the same issue
> >
> > Any help would be greatly be appreciated..
> >
> > thanks,
> > Richard.
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <Configuration status="TRACE" name="API" packages=""
> monitorInterval="30">
> >    <Appenders>
> >    <RollingRandomAccessFile name="CatchAll" fileName="logs/all.log"
> > immediateFlush="false" append="true"
> > FilePattern="logs/$${date:yyyy-MM}/all-%d{yyyy-MM-dd}-%i.log.gz">
> >      <PatternLayout>
> >        <Pattern>%d %m%n</Pattern>
> >      </PatternLayout>
> >            <Policies>
> >                <TimeBasedTriggeringPolicy interval="1" modulate="true" />
> >                <SizeBasedTriggeringPolicy size="2 GB"/>
> >            </Policies>
> >            <DefaultRolloverStrategy max="20"/>
> >    </RollingRandomAccessFile>
> >    <RollingRandomAccessFile name="Audit" fileName="logs/audit.log"
> > immediateFlush="false" append="true"
> > FilePattern="logs/$${date:yyyy-MM}/audit-%d{yyyy-MM-dd_hh_mm}-%i.log.gz">
> >      <PatternLayout>
> >        <Pattern>%d %m%n</Pattern>
> >      </PatternLayout>
> >            <Policies>
> >                <TimeBasedTriggeringPolicy interval="1" modulate="true" />
> >                <SizeBasedTriggeringPolicy size="2 GB"/>
> >            </Policies>
> >            <DefaultRolloverStrategy max="20"/>
> >    </RollingRandomAccessFile>
> >    <RollingRandomAccessFile name="Fault" fileName="logs/fault.log"
> > immediateFlush="false" append="true" FilePattern="
> > *logs/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd_hh_mm}-%i.log.gz*">
> >      <PatternLayout>
> >        <Pattern>%d %m%n</Pattern>
> >      </PatternLayout>
> >            <Policies>
> >                <TimeBasedTriggeringPolicy interval="1" modulate="true" />
> >                <SizeBasedTriggeringPolicy size="2 GB"/>
> >            </Policies>
> >            <DefaultRolloverStrategy max="20"/>
> >    </RollingRandomAccessFile>
> >
> >
> >   <RollingRandomAccessFile name="LegacyAudit"
> > fileName="logs/webservices.log" immediateFlush="false" append="true"
> > FilePattern="
> > *logs/$${date:yyyy-MM}/webservices-%d{yyyy-MM-dd_hh_mm}-%i.log.gz*">
> >      <PatternLayout>
> >        <Pattern>%d %m%n</Pattern>
> >      </PatternLayout>
> >            <Policies>
> >                <TimeBasedTriggeringPolicy interval="1" modulate="true" />
> >                <SizeBasedTriggeringPolicy size="2 GB"/>
> >            </Policies>
> >            <DefaultRolloverStrategy max="20"/>
> >    </RollingRandomAccessFile>
> >
> >
> >
> >    </Appenders>
> > <!-- Don't forget to set system property for Async
> >
> -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
> >     to make all loggers asynchronous. -->
> >    <Loggers>
> >        <Logger name="x.FcapsInterceptor" level="trace">
> >            <AppenderRef ref="Audit"/>
> >        </Logger>
> >        <Logger name="x.FcapsRpcInterceptor" level="trace">
> >            <AppenderRef ref="*LegacyAudit*"/>
> >        </Logger>
> >
> >       <Logger name="x.Fault" level="trace">
> >            <AppenderRef ref="*Fault*"/>
> >        </Logger>
> >    <!--Root level="trace">
> >      <AppenderRef ref="CatchAll"/>
> >    </Root-->
> >    </Loggers>
> > </Configuration>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
 		 	   		  

Re: Intermittent log file compression issue

Posted by Richard Kolb <rj...@gmail.com>.
Hi Remko,

Thanks, very much.
Changing FilePattern to filePattern did not solve the issue.
The * was an typeo in the email, sorry for that.

I am still experiencing the same issue inside the container and I can't
recreate the issue with the same log4j2.xml outside the container.

Next step is to check the log4j2 fine logs and I will report back.

Regards,
Richard.
Can you try filePattern with a lower-case 'f' and remove the '*' characters
from the filePattern path?

For example:
> FilePattern="
> *logs/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd_hh_mm}-%i.log.gz*"


Should be
> filePattern="
> logs/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd_hh_mm}-%i.log.gz"


Regards,
Remko

Sent from my iPhone

> On 2015/03/24, at 17:12, Richard Kolb <rj...@gmail.com> wrote:
>
> Hello,
>
> I am using log4j 2.2 on Windows 2008 using Java 7 and I'm experiencing an
> intermittent issue where my log files used to compress, but now just move
> to the archive directory uncompressed.
>
> To debug, I changed the file pattern to be on the minute level (in bold),
> and I am getting the same issue
>
> Any help would be greatly be appreciated..
>
> thanks,
> Richard.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <Configuration status="TRACE" name="API" packages=""
monitorInterval="30">
>    <Appenders>
>    <RollingRandomAccessFile name="CatchAll" fileName="logs/all.log"
> immediateFlush="false" append="true"
> FilePattern="logs/$${date:yyyy-MM}/all-%d{yyyy-MM-dd}-%i.log.gz">
>      <PatternLayout>
>        <Pattern>%d %m%n</Pattern>
>      </PatternLayout>
>            <Policies>
>                <TimeBasedTriggeringPolicy interval="1" modulate="true" />
>                <SizeBasedTriggeringPolicy size="2 GB"/>
>            </Policies>
>            <DefaultRolloverStrategy max="20"/>
>    </RollingRandomAccessFile>
>    <RollingRandomAccessFile name="Audit" fileName="logs/audit.log"
> immediateFlush="false" append="true"
> FilePattern="logs/$${date:yyyy-MM}/audit-%d{yyyy-MM-dd_hh_mm}-%i.log.gz">
>      <PatternLayout>
>        <Pattern>%d %m%n</Pattern>
>      </PatternLayout>
>            <Policies>
>                <TimeBasedTriggeringPolicy interval="1" modulate="true" />
>                <SizeBasedTriggeringPolicy size="2 GB"/>
>            </Policies>
>            <DefaultRolloverStrategy max="20"/>
>    </RollingRandomAccessFile>
>    <RollingRandomAccessFile name="Fault" fileName="logs/fault.log"
> immediateFlush="false" append="true" FilePattern="
> *logs/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd_hh_mm}-%i.log.gz*">
>      <PatternLayout>
>        <Pattern>%d %m%n</Pattern>
>      </PatternLayout>
>            <Policies>
>                <TimeBasedTriggeringPolicy interval="1" modulate="true" />
>                <SizeBasedTriggeringPolicy size="2 GB"/>
>            </Policies>
>            <DefaultRolloverStrategy max="20"/>
>    </RollingRandomAccessFile>
>
>
>   <RollingRandomAccessFile name="LegacyAudit"
> fileName="logs/webservices.log" immediateFlush="false" append="true"
> FilePattern="
> *logs/$${date:yyyy-MM}/webservices-%d{yyyy-MM-dd_hh_mm}-%i.log.gz*">
>      <PatternLayout>
>        <Pattern>%d %m%n</Pattern>
>      </PatternLayout>
>            <Policies>
>                <TimeBasedTriggeringPolicy interval="1" modulate="true" />
>                <SizeBasedTriggeringPolicy size="2 GB"/>
>            </Policies>
>            <DefaultRolloverStrategy max="20"/>
>    </RollingRandomAccessFile>
>
>
>
>    </Appenders>
> <!-- Don't forget to set system property for Async
>
-DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
>     to make all loggers asynchronous. -->
>    <Loggers>
>        <Logger name="x.FcapsInterceptor" level="trace">
>            <AppenderRef ref="Audit"/>
>        </Logger>
>        <Logger name="x.FcapsRpcInterceptor" level="trace">
>            <AppenderRef ref="*LegacyAudit*"/>
>        </Logger>
>
>       <Logger name="x.Fault" level="trace">
>            <AppenderRef ref="*Fault*"/>
>        </Logger>
>    <!--Root level="trace">
>      <AppenderRef ref="CatchAll"/>
>    </Root-->
>    </Loggers>
> </Configuration>

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org

Re: Intermittent log file compression issue

Posted by Remko Popma <re...@gmail.com>.
Can you try filePattern with a lower-case 'f' and remove the '*' characters from the filePattern path? 

For example:
> FilePattern="
> *logs/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd_hh_mm}-%i.log.gz*"


Should be
> filePattern="
> logs/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd_hh_mm}-%i.log.gz"


Regards,
Remko

Sent from my iPhone

> On 2015/03/24, at 17:12, Richard Kolb <rj...@gmail.com> wrote:
> 
> Hello,
> 
> I am using log4j 2.2 on Windows 2008 using Java 7 and I'm experiencing an
> intermittent issue where my log files used to compress, but now just move
> to the archive directory uncompressed.
> 
> To debug, I changed the file pattern to be on the minute level (in bold),
> and I am getting the same issue
> 
> Any help would be greatly be appreciated..
> 
> thanks,
> Richard.
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <Configuration status="TRACE" name="API" packages=""  monitorInterval="30">
>    <Appenders>
>    <RollingRandomAccessFile name="CatchAll" fileName="logs/all.log"
> immediateFlush="false" append="true"
> FilePattern="logs/$${date:yyyy-MM}/all-%d{yyyy-MM-dd}-%i.log.gz">
>      <PatternLayout>
>        <Pattern>%d %m%n</Pattern>
>      </PatternLayout>
>            <Policies>
>                <TimeBasedTriggeringPolicy interval="1" modulate="true" />
>                <SizeBasedTriggeringPolicy size="2 GB"/>
>            </Policies>
>            <DefaultRolloverStrategy max="20"/>
>    </RollingRandomAccessFile>
>    <RollingRandomAccessFile name="Audit" fileName="logs/audit.log"
> immediateFlush="false" append="true"
> FilePattern="logs/$${date:yyyy-MM}/audit-%d{yyyy-MM-dd_hh_mm}-%i.log.gz">
>      <PatternLayout>
>        <Pattern>%d %m%n</Pattern>
>      </PatternLayout>
>            <Policies>
>                <TimeBasedTriggeringPolicy interval="1" modulate="true" />
>                <SizeBasedTriggeringPolicy size="2 GB"/>
>            </Policies>
>            <DefaultRolloverStrategy max="20"/>
>    </RollingRandomAccessFile>
>    <RollingRandomAccessFile name="Fault" fileName="logs/fault.log"
> immediateFlush="false" append="true" FilePattern="
> *logs/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd_hh_mm}-%i.log.gz*">
>      <PatternLayout>
>        <Pattern>%d %m%n</Pattern>
>      </PatternLayout>
>            <Policies>
>                <TimeBasedTriggeringPolicy interval="1" modulate="true" />
>                <SizeBasedTriggeringPolicy size="2 GB"/>
>            </Policies>
>            <DefaultRolloverStrategy max="20"/>
>    </RollingRandomAccessFile>
> 
> 
>   <RollingRandomAccessFile name="LegacyAudit"
> fileName="logs/webservices.log" immediateFlush="false" append="true"
> FilePattern="
> *logs/$${date:yyyy-MM}/webservices-%d{yyyy-MM-dd_hh_mm}-%i.log.gz*">
>      <PatternLayout>
>        <Pattern>%d %m%n</Pattern>
>      </PatternLayout>
>            <Policies>
>                <TimeBasedTriggeringPolicy interval="1" modulate="true" />
>                <SizeBasedTriggeringPolicy size="2 GB"/>
>            </Policies>
>            <DefaultRolloverStrategy max="20"/>
>    </RollingRandomAccessFile>
> 
> 
> 
>    </Appenders>
> <!-- Don't forget to set system property for Async
> -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
>     to make all loggers asynchronous. -->
>    <Loggers>
>        <Logger name="x.FcapsInterceptor" level="trace">
>            <AppenderRef ref="Audit"/>
>        </Logger>
>        <Logger name="x.FcapsRpcInterceptor" level="trace">
>            <AppenderRef ref="*LegacyAudit*"/>
>        </Logger>
> 
>       <Logger name="x.Fault" level="trace">
>            <AppenderRef ref="*Fault*"/>
>        </Logger>
>    <!--Root level="trace">
>      <AppenderRef ref="CatchAll"/>
>    </Root-->
>    </Loggers>
> </Configuration>

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org