extends RollingFileAppender

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

extends RollingFileAppender

EDMONDO SENA
Hi,

it seems that is not possible to extend it in log4j2, because apache have made it a final class in log4j2. In earlier version of log4j was possible easily extends it.
This migration steps also doesn't specify how to move this functionality to log4j2.

Can you write me how fix it?

Thanks.
//Edmondo.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: extends RollingFileAppender

Ralph Goers
Did you rewrite Log4j 1?

As I said in my previous email it would be better if you explained what customizations you had to do and why so we could explain the correct approach for Log4j 2.  Trying to just port your Log4j 1.x customizations to Log4j 2 is not the correct approach.

Yes, RollingFileAppender is final. You would have to tell us what you were trying to customize before we can tell you how to do it.

Ralph

> On Feb 19, 2020, at 8:00 AM, EDMONDO SENA <[hidden email]> wrote:
>
> Hi,
>
> it seems that is not possible to extend it in log4j2, because apache have made it a final class in log4j2. In earlier version of log4j was possible easily extends it.
> This migration steps also doesn't specify how to move this functionality to log4j2.
>
> Can you write me how fix it?
>
> Thanks.
> //Edmondo.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: extends RollingFileAppender

EDMONDO SENA
We've create a class ClLogFileAppender that extends RollingFileAppender.
This class include other log type Files specific for our project.
Example (Zip file,archive logs file, compress file, remove compressed file) and so on.
You extend that class in order to enlarge log type files.

 

On 2020/02/19 15:19:28, Ralph Goers <[hidden email]> wrote:

> Did you rewrite Log4j 1?
>
> As I said in my previous email it would be better if you explained what customizations you had to do and why so we could explain the correct approach for Log4j 2.  Trying to just port your Log4j 1.x customizations to Log4j 2 is not the correct approach.
>
> Yes, RollingFileAppender is final. You would have to tell us what you were trying to customize before we can tell you how to do it.
>
> Ralph
>
> > On Feb 19, 2020, at 8:00 AM, EDMONDO SENA <[hidden email]> wrote:
> >
> > Hi,
> >
> > it seems that is not possible to extend it in log4j2, because apache have made it a final class in log4j2. In earlier version of log4j was possible easily extends it.
> > This migration steps also doesn't specify how to move this functionality to log4j2.
> >
> > Can you write me how fix it?
> >
> > Thanks.
> > //Edmondo.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: extends RollingFileAppender

Ralph Goers
The RollingFileAppender in Log4j 2 already supports pretty much every compression type and supports removing files. See http://logging.apache.org/log4j/2.x/manual/appenders.html#RollingFileAppender <http://logging.apache.org/log4j/2.x/manual/appenders.html#RollingFileAppender>.

Under Rollover Strategy / Default Rollover Strategy

"If the file pattern ends with ".gz", ".zip", ".bz2", ".deflate", ".pack200", or ".xz" the resulting archive will be compressed using the compression scheme that matches the suffix”

The see the section named "Log Archive Retention Policy: Delete on Rollover” and its examples.

Ralph




> On Feb 19, 2020, at 8:26 AM, EDMONDO SENA <[hidden email]> wrote:
>
> We've create a class ClLogFileAppender that extends RollingFileAppender.
> This class include other log type Files specific for our project.
> Example (Zip file,archive logs file, compress file, remove compressed file) and so on.
> You extend that class in order to enlarge log type files.
>
>
>
> On 2020/02/19 15:19:28, Ralph Goers <[hidden email]> wrote:
>> Did you rewrite Log4j 1?
>>
>> As I said in my previous email it would be better if you explained what customizations you had to do and why so we could explain the correct approach for Log4j 2.  Trying to just port your Log4j 1.x customizations to Log4j 2 is not the correct approach.
>>
>> Yes, RollingFileAppender is final. You would have to tell us what you were trying to customize before we can tell you how to do it.
>>
>> Ralph
>>
>>> On Feb 19, 2020, at 8:00 AM, EDMONDO SENA <[hidden email]> wrote:
>>>
>>> Hi,
>>>
>>> it seems that is not possible to extend it in log4j2, because apache have made it a final class in log4j2. In earlier version of log4j was possible easily extends it.
>>> This migration steps also doesn't specify how to move this functionality to log4j2.
>>>
>>> Can you write me how fix it?
>>>
>>> Thanks.
>>> //Edmondo.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

Reply | Threaded
Open this post in threaded view
|

Re: extends RollingFileAppender

Ralph Goers
FWIW, if that still isn’t enough you could create your own custom Action classes. You could look at https://github.com/apache/logging-log4j2/blob/master/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/GzCompressAction.java <https://github.com/apache/logging-log4j2/blob/master/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/GzCompressAction.java> as an example. You would then need to create your own custom RolloverStrategy. You would look at https://github.com/apache/logging-log4j2/blob/master/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java <https://github.com/apache/logging-log4j2/blob/master/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/DefaultRolloverStrategy.java> for an example. In that class you will see it determines the Action to perform for compression by retrieving it from https://github.com/apache/logging-log4j2/blob/master/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/FileExtension.java <https://github.com/apache/logging-log4j2/blob/master/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/FileExtension.java>.

Ralph

> On Feb 19, 2020, at 8:37 AM, Ralph Goers <[hidden email]> wrote:
>
> The RollingFileAppender in Log4j 2 already supports pretty much every compression type and supports removing files. See http://logging.apache.org/log4j/2.x/manual/appenders.html#RollingFileAppender <http://logging.apache.org/log4j/2.x/manual/appenders.html#RollingFileAppender>.
>
> Under Rollover Strategy / Default Rollover Strategy
>
> "If the file pattern ends with ".gz", ".zip", ".bz2", ".deflate", ".pack200", or ".xz" the resulting archive will be compressed using the compression scheme that matches the suffix”
>
> The see the section named "Log Archive Retention Policy: Delete on Rollover” and its examples.
>
> Ralph
>
>
>
>
>> On Feb 19, 2020, at 8:26 AM, EDMONDO SENA <[hidden email]> wrote:
>>
>> We've create a class ClLogFileAppender that extends RollingFileAppender.
>> This class include other log type Files specific for our project.
>> Example (Zip file,archive logs file, compress file, remove compressed file) and so on.
>> You extend that class in order to enlarge log type files.
>>
>>
>>
>> On 2020/02/19 15:19:28, Ralph Goers <[hidden email]> wrote:
>>> Did you rewrite Log4j 1?
>>>
>>> As I said in my previous email it would be better if you explained what customizations you had to do and why so we could explain the correct approach for Log4j 2.  Trying to just port your Log4j 1.x customizations to Log4j 2 is not the correct approach.
>>>
>>> Yes, RollingFileAppender is final. You would have to tell us what you were trying to customize before we can tell you how to do it.
>>>
>>> Ralph
>>>
>>>> On Feb 19, 2020, at 8:00 AM, EDMONDO SENA <[hidden email]> wrote:
>>>>
>>>> Hi,
>>>>
>>>> it seems that is not possible to extend it in log4j2, because apache have made it a final class in log4j2. In earlier version of log4j was possible easily extends it.
>>>> This migration steps also doesn't specify how to move this functionality to log4j2.
>>>>
>>>> Can you write me how fix it?
>>>>
>>>> Thanks.
>>>> //Edmondo.
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [hidden email]
>>>> For additional commands, e-mail: [hidden email]
>>>>
>>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>