I am relatively new to log4j and java in general.
I have established a SimpleSocketServer to receive log events from a
SocketAppender.
I am using org.apache.log4j.rolling.RollingFileAppender to roll my
files using org.apache.log4j.rolling.TimeBasedRollingPolicy
What I would really like to do is 'post' the log file to a web site
when it is rolled. (where it will be mangled, analysed, reported upon,
etc) then leave the log file where the time based policy put it (for
subsequent clean up).
Is there something that will do this for me already?
If not, is there a guide somewhere that shows me how to establish my
own policy, I envisage, by extending the
org.apache.log4j.rolling.TimeBasedRollingPolicy to do the 'http post'
after org.apache.log4j.rolling.TimeBasedRollingPolicy has done it's
rename/compress/etc?
Any assistance would be greatly appreciated.
...Lyall
Lyall - 13 Apr 2006 05:13 GMT
Ok, after further investigation, it would appear I have to write my own
TimeBasedRollingHttpPostPolicy class, which, as a basis, I am going to
cut/paste the TimeBasedRollingPolicy and do my stuff.
Excuse my ignorance, but this seems like an ideal opportunity to extend
the TimeBasedRollingPolicy and yet I cannot, because it is 'final'.
Would someone enlighten me as to why I should not be extending
TimeBasedRollingPolicy, thus, forcing me to 'duplicate' rather than
'reuse'?
Is it final by mistake or by design? If by design, why?
...Lyall