Assuming you set the key-value pair as an MDC entry, this could work
(the filter will be part of log4j1.3 - currently in CVS):
Add to an appender:
<filter class="org.apache.log4j.varia.ExpressionFilter">
<param name="Expression" value="MDC.mykey == 'myvalue'" />
<param name="AcceptOnMatch" value="true" />
</filter>
-----Original Message-----
From: Roth Marcel [mailto:[EMAIL PROTECTED]
Sent: Monday, January 26, 2004 9:01 AM
To: Log4J Users List
Subject: Re: SMTPAppender
Hi Jeb,
a way to do this is via implementing the TriggeringEventEvaluator. Try
something like this cheers, Marcel
/***********************************************************************
* SMTP Trigger Event Evaluator
*/
private static class SMTPTriggerEval implements
TriggeringEventEvaluator {
SMTPAppender app;
public void setSMTPAppender(SMTPAppender app) {
this.app = app;
}
public boolean isTriggeringEvent(LoggingEvent event) {
if (event.level.isGreaterOrEqual(Level.FATAL)) {
return true;
} else {
if (app != null) {
// reset the message content
int size = app.getBufferSize();
app.setBufferSize(0);
app.setBufferSize(size);
}
return false;
}
}
}
Quoting Jeb Scarbrough <[EMAIL PROTECTED]>:
> I am wanting to send all logs messags via email when i send POST a
> certain key-value pair to my servlet. In essence, allowing me to see
> a debug log of
> one specific request. I'm new with log4j and havent found much on
this
> in
> the archives. has anyone tried to do this? is it possible? would
what
> be a
> good starting point to accomplishing something like this?
>
> Thanks.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
Marcel Roth
Technology Consultant
Enterprise CRM
_______________________________
Softlab AG
Kanalstrasse 31
CH-8152 Glattbrugg
Switzerland
Telefon +41 1 809 41 57
Telefax +41 1 809 41 42
Mobile +41 76 420 02 07
E-Mail mailto:[EMAIL PROTECTED]
Homepage: http://www.softlab.ch _______________________________
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]