[ 
https://issues.apache.org/jira/browse/LOG4NET-579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17037010#comment-17037010
 ] 

Ferenc HORVÁTH commented on LOG4NET-579:
----------------------------------------

Hi Dimitri,

 

Find them attached, feel free yourself to use. (log4net 2.0.8 is a dependency 
for this lib, binary built using .NET 4.5.2)

Configuration is very similar to the RollingFileAppender, _type_ is the 
important part e.g.:
{code:java}
  <appender name="RfAppender" 
type="Log4Net.Appender.Misc.CompressorRollingFileAppender, Log4NetAppenderMisc">
    <file type="log4net.Util.PatternString" value="e:\logdir\logfile.log" />
    <appendToFile value="true" />
    <rollingStyle value="Date" />
    <datePattern value=".yyyyMMdd" />
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%date (%logger) [%-5level] {%thread} - %message 
%exception %newline" />
    </layout>
  </appender>
{code}
After rolling you will find a file like "logfile.log.20200214.gz".

 

Best regards and good luck:

Ferenc

> RollingFileAppender - file compression feature
> ----------------------------------------------
>
>                 Key: LOG4NET-579
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-579
>             Project: Log4net
>          Issue Type: New Feature
>          Components: Appenders
>            Reporter: Ferenc HORVÁTH
>            Priority: Major
>         Attachments: Log4NetAppenderMisc-bin.zip, Log4NetAppenderMisc-src.zip
>
>
> Hi Guys,
> I used _log4j_ in the past, and its {{RollingFileAppender}} has the 
> possibility to compress the rolled file. It would be a nice feature in 
> _log4net_ too, because it is much easier to handle the rolled files in 
> compressed format. After a lot of searching I did not find a built-in 
> solution in _log4net_ for compression, I decided to implement it. I wanted to 
> do it using the {{RollFile}} method, but I was not able to do it, because the 
> {{RollFile}} method is not _virtual_ this time. So the solution was for me: I 
> copied the {{RollingFileAppender}} into a custom namespace, made its 
> {{RollFile}} _virtual_, and wrote a subclass which had a customized 
> {{RollFile}} method. At least a _virtual_ {{RollFile}} method would be useful 
> too.
> Thanks:
> Ferenc



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to