log4j 1.3: RollingPolicy - TimeBasedRollingPolicy - custom actions

L

Lyall

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
 
L

Lyall

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top