logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From christ...@myvm.de
Subject Hook into the RollingFileManager#write / Get notice about written bytes
Date Tue, 16 Feb 2016 16:31:17 GMT
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, 
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,


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

View raw message