[OT] Batch-processing of emailed log4j log messages

2010-02-24 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

All,

We use log4j for logging in our webapps, and I'm considering enabling
email notifications of errors. Not that it would ever happen (of
course!), but I want to avoid a situation where some bug is triggered
and thousands of log messages are emitted, each sent individually to me.

I checked the Javadoc for SMTPAppender and it looks like there is some
sort of buffering going on, but there appear to be very few options for
controlling the frequency of message sending (I'd probably want ~5
minute intervals or so).

It looks like I can use a TriggeringEventEvaluator coupled with a
background thread that, say, issues a SEND EMAIL NOW message at
intervals so flush whatever buffer exists in the appender.

Has anyone ever done anything like this before? If so, do you have any tips?

Thanks,
- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkuFP0sACgkQ9CaO5/Lv0PCdggCfRwTq12uW0xNw4Bwjzfw9J8cH
4mUAn3gvtxAqAfVv584n2JirYu4DtNNB
=fGQ0
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: [OT] Batch-processing of emailed log4j log messages

2010-02-24 Thread Mark H. Wood
An alternative approach:  you could pump the messages through a
mailing-list digest builder.  You may get 100 messages in five
minutes, but you only get interrupted once.

Sorry, I've never run a digested list so I don't have a name handy.

-- 
Mark H. Wood, Lead System Programmer   mw...@iupui.edu
Friends don't let friends publish revisable-form documents.


pgpKRZKNFSpY2.pgp
Description: PGP signature


Re: [OT] Batch-processing of emailed log4j log messages

2010-02-24 Thread Pid

On 24/02/2010 17:17, Mark H. Wood wrote:

An alternative approach:  you could pump the messages through a
mailing-list digest builder.  You may get 100 messages in five
minutes, but you only get interrupted once.

Sorry, I've never run a digested list so I don't have a name handy.


That's smart, like it.


p




-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: [OT] Batch-processing of emailed log4j log messages

2010-02-24 Thread André Warnier

Pid wrote:

On 24/02/2010 17:17, Mark H. Wood wrote:

An alternative approach:  you could pump the messages through a
mailing-list digest builder.  You may get 100 messages in five
minutes, but you only get interrupted once.

Sorry, I've never run a digested list so I don't have a name handy.


That's smart, like it.

Another similar but simpler way would be to have the application write 
messages to a simple logfile, and then have a separate application (like 
a shell script under cron), which runs at the frequency you want, pick 
up the content of that file, mail it to you all at once, optionally 
archive the logfile (cat  somewhere.else), and reset the logfile 
(truncate it to 0 size).



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: [OT] Batch-processing of emailed log4j log messages

2010-02-24 Thread André Warnier

André Warnier wrote:

Pid wrote:

On 24/02/2010 17:17, Mark H. Wood wrote:

An alternative approach:  you could pump the messages through a
mailing-list digest builder.  You may get 100 messages in five
minutes, but you only get interrupted once.

Sorry, I've never run a digested list so I don't have a name handy.


That's smart, like it.

Another similar but simpler way would be to have the application write 
messages to a simple logfile, and then have a separate application (like 
a shell script under cron), which runs at the frequency you want, pick 
up the content of that file, mail it to you all at once, optionally 
archive the logfile (cat  somewhere.else), and reset the logfile 
(truncate it to 0 size).




A bit of awk (or perl) magic might even summarise this with neat
.. above message repeated nn times ..
stuff.
Come to think of it, the whole thing in perl is probably a 10-liner, 
using a hundreth of the memory you'd need with Java.


Boom, troll, flame,...



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: [OT] Batch-processing of emailed log4j log messages

2010-02-24 Thread Peter Crowther
On 24 February 2010 18:38, André Warnier a...@ice-sa.com wrote:
 Come to think of it, the whole thing in perl is probably a 10-liner, using a
 hundreth of the memory you'd need with Java.

Yep, absolutely - the kind of processing that perl was designed for,
and is very good at.

I'd make other comments about perl's ancestry and its use as a
general-purpose programming language, but then I'd be responding to
the troll with a flame ;-).

- Peter

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: [OT] Batch-processing of emailed log4j log messages

2010-02-24 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

André,

On 2/24/2010 1:38 PM, André Warnier wrote:
 André Warnier wrote:
 Pid wrote:
 On 24/02/2010 17:17, Mark H. Wood wrote:
 An alternative approach:  you could pump the messages through a
 mailing-list digest builder.  You may get 100 messages in five
 minutes, but you only get interrupted once.

 Sorry, I've never run a digested list so I don't have a name handy.

 That's smart, like it.

 Another similar but simpler way would be to have the application write
 messages to a simple logfile, and then have a separate application
 (like a shell script under cron), which runs at the frequency you
 want, pick up the content of that file, mail it to you all at once,
 optionally archive the logfile (cat  somewhere.else), and reset the
 logfile (truncate it to 0 size).


 A bit of awk (or perl) magic might even summarise this with neat
 .. above message repeated nn times ..
 stuff.
 Come to think of it, the whole thing in perl is probably a 10-liner,
 using a hundreth of the memory you'd need with Java.

Care to throw down the gauntlet with some code? I'd love to see
something that can coalesce log messages in such a way.

Remember that some log messages have more than one line of output, like
stack traces and all that.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkuFpIEACgkQ9CaO5/Lv0PAK5ACguqe97/s9cT3q+WZq3rhCFPrt
PqgAoLkvo68RbdnYPxe0aLtf0+aOph+h
=ivAP
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: [OT] Batch-processing of emailed log4j log messages

2010-02-24 Thread André Warnier

Christopher Schultz wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

André,


..


Care to throw down the gauntlet with some code? I'd love to see
something that can coalesce log messages in such a way.


Me and my big mouth.
This was meant to be a troll, triggering a flame.  It wasn't meant 
seriously.
But ok, I'll bite, because it's something I might need too some day. 
Give me a couple of days though, I'm pretty busy right now.




Remember that some log messages have more than one line of output, like
stack traces and all that.


But those are unlikely to have repeating lines.  And I can cheat, 
replacing the message above by

 .. above line repeated nn times ..

Send me a sample of your logfile, I'd like to see the look of your 
timestamps.



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: [OT] Batch-processing of emailed log4j log messages

2010-02-24 Thread André Warnier

Peter Crowther wrote:

On 24 February 2010 18:38, André Warnier a...@ice-sa.com wrote:

Come to think of it, the whole thing in perl is probably a 10-liner, using a
hundreth of the memory you'd need with Java.


Yep, absolutely - the kind of processing that perl was designed for,
and is very good at.

I'd make other comments about perl's ancestry and its use as a
general-purpose programming language, but then I'd be responding to
the troll with a flame ;-).

Very unfair of you to defuse a sneaky gramme-sized provocation attempt 
with a pound of reasonableness.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org