logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Sicker <boa...@gmail.com>
Subject Re: Hook into the RollingFileManager#write / Get notice about written bytes
Date Wed, 09 Mar 2016 17:37:32 GMT
Appenders are usually final because the appender itself doesn't do much
work (the managers do that), or at least that's what I gather.

On 16 February 2016 at 10:31, <christian@myvm.de> wrote:

> Hi all,
>
> this is the first time I'm writing to a mailing list - I hope I will do
> it the right way :)
>
>
> I migrated a few days ago from Log4J 1.2 to Log4J 2: In general I must
> say: nice work guys and nice plugin system!
>
> But: I'm struggling with finding a way to get notice about the exact
> size of written bytes. I want to find a way how to do some stuff when X
> bytes were written in Y seconds. I couldn't use a filter and check the
> LogEvent because it's not possible to get the actual size of written
> bytes afterwards (because the layout will transform this...)
>
> I'm using a RollingFileAppender and could see, that this is using the
> RollingFileManager and the perfect way would be to hook into this
> write(byte[]) method.. but I can't find how to do this.
>
> In general I would create a subclass and overwrite write(byte[]).. but
> this is impossible because everything there is final. All appenders, all
> appender managers, all layouts, ... and I think it's not the way it
> should be when I create a new "MyRollingFileAppender" and copy all the
> stuff and add the part I need to the write method.
>
>
> So is there anybody who could maybe help and know a solution for this
> problem? And is there a specific reason that everything is final? :(
>
>
>
> Thank you in advance and best regards,
>
> Christian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>


-- 
Matt Sicker <boards@gmail.com>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message