logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <ralph.go...@dslextreme.com>
Subject Re: On rollover, gzip and keep unzipped file
Date Fri, 25 Jan 2019 20:18:25 GMT
Can you explain the use case for why you would want both?  The primary reason for gzipping
the files is to save space. Having both causes more space to be used.

Ralph

> On Jan 24, 2019, at 12:35 AM, Sameer Pradhan <spradhan@4info.com> wrote:
> 
> I am currently using
> 
> 
> 
> <RollingRandomAccessFile name="RollingRequestAppender"
> 
>    fileName="/mypath/log/requests.log"
> 
>    filePattern="/mypath/log/requests.log.%d{yyyy-MM-dd-HH-mm}.gz"
> 
>    immediateFlush="false" append="true">
> 
>    <DefaultRolloverStrategy
> 
>        fileIndex="nomax"
> 
>    tempCompressedFilePattern="/mypath/log/requests.log.%d{yyyy-MM-dd-HH-mm}.gz.tmp"/>
> 
>    <PatternLayout>
> 
>        <Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS Z}%m%n</Pattern>
> 
>    </PatternLayout>
> 
>    <Policies>
> 
>        <TimeBasedTriggeringPolicy interval="1" modulate="true" />
> 
>    </Policies>
> 
> </RollingRandomAccessFile>
> 
> 
> 
> This produces the compressed rolled over file.
> 
> Removing .gz from the file pattern produces the uncompressed file.
> 
>    filePattern="/mypath/log/requests.log.%d{yyyy-MM-dd-HH-mm}.gz"
> 
> 
> 
> The idea is to have both created by log4j
> 
> 
> 
> Thanks.
> 
> -Sameer
> 
> 
> 
> On 1/23/19, 6:11 PM, "Sameer Pradhan" <spradhan@4info.com> wrote:
> 
> 
> 
>    When log4j rolls over a file and the filePattern ends with a compressed file suffic
like .gz, log4j compresses the rolled over file, which is quite useful.
> 
> 
> 
>    What I need is to have a uncompressed as well as a compressed rolled over file. Yeah,
that sounds a lot like having my cake and eating it too 😊
> 
> 
> 
>    How can I achieve this? This would be the log4j equivalent of gzip -k <filename>
which keeps the original file.
> 
>    I want to avoid rolling over to a gzipped file, and then uncompressing it myself.
> 
>    Or rolling over to uncompressed file and compressing it myself.
> 
>    Rather, need both files to be created by log4j
> 
> 
> 
>    Appreciate any suggestions.
> 
> 
> 
>    Thanks,
> 
>    -Sameer Pradhan
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 



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


Mime
View raw message