You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Hans Schwaebli <ha...@yahoo.com> on 2007/07/04 15:55:49 UTC
How to always log the host name?
How can I configure the log4j logging to add the hostname information into the logging output?
Most naturally would be to find a conversion character for the hostname in the PatternLayout. But there is none.
---------------------------------
Building a website is a piece of cake.
Yahoo! Small Business gives you all the tools to get online.
RE: Recipients of email appender depending on log message, possible?
Posted by Scott Deboy <sd...@comotivsystems.com>.
There aren't any good examples of the filter syntax that I could find.
Here's a link where someone's doing something similar. Note, you chain
filters one after another, so sometimes you may need to end the chain
with a DenyAllFilter.
http://www.webdeveloper.com/forum/showthread.php?t=91074
Scott Deboy
Principal Engineer
COMOTIV SYSTEMS
111 SW Columbia Street Ste. 950
Portland, OR 97201
Office: 503.224.7496
Direct Line: 503.821.6482
Cell: 503.997.1367
Fax: 503.222.0185
sdeboy@comotivsystems.com
www.comotivsystems.com
-----Original Message-----
From: Hans Schwaebli [mailto:hans_schwaebli@yahoo.com]
Sent: Wednesday, July 11, 2007 12:30 PM
To: Log4J Users List
Subject: Re: Recipients of email appender depending on log message,
possible?
Come on... You know what I mean. I didn't find any good manual or
tutorial freely available for log4j. And I searched for half an hour.
Excuse me if I then dare to ask here. So if anyone can tell me, I would
be glad.
James Stauffer <st...@gmail.com> wrote: Did you search the
mailing list archives, wiki, and javadocs?
On 7/11/07, Hans Schwaebli wrote:
> It seems this is a solution. But I couldn't find a site where using
log4j filters is described. Any idea?
>
>
> James Stauffer wrote:
> You might be able to achieve that with an appender filter.
>
> On 7/11/07, Hans Schwaebli wrote:
> > I want to send a email depending on the log text. I add the terminal
ID to the log text, which is the one of the user who caused the
exception, which is logged at error level. Depending on that ID (or a
regular expression) I want to send the email to certain recipients.
> >
> > Does this work with log4j configuration out of the box? What is the
solution for this?
> >
> >
> > ---------------------------------
> > Yahoo! oneSearch: Finally, mobile search that gives answers, not web
links.
>
>
> --
> James Stauffer http://www.geocities.com/stauffer_james/
> Are you good? Take the test at http://www.livingwaters.com/good/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
>
>
> ---------------------------------
> Got a little couch potato?
> Check out fun summer activities for kids.
--
James Stauffer http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
---------------------------------
Building a website is a piece of cake.
Yahoo! Small Business gives you all the tools to get online.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
RE: Recipients of email appender depending on log message, possible?
Posted by Hans Schwaebli <ha...@yahoo.com>.
Ok, but it takes too long for me.
I have written an own Filter. See Attachment.
Scott Deboy <sd...@comotivsystems.com> wrote:
BTW, you will be able to use an ExpressionFilter to build regexps that
can evaluate message text, MDC entries, etc (part of a log4j release
soon hopefully).
Scott Deboy
Principal Engineer
COMOTIV SYSTEMS
111 SW Columbia Street Ste. 950
Portland, OR 97201
Office: 503.224.7496
Direct Line: 503.821.6482
Cell: 503.997.1367
Fax: 503.222.0185
sdeboy@comotivsystems.com
www.comotivsystems.com
-----Original Message-----
From: Hans Schwaebli [mailto:hans_schwaebli@yahoo.com]
Sent: Thursday, July 12, 2007 4:42 AM
To: Log4J Users List
Subject: Re: Recipients of email appender depending on log message,
possible?
I think it is no great problem to write a custom filter which reads the
MDC content, although it would take some time to write and to test and
maintain it.
So I rather would like to use a addon or something, if it exists,
which does this.
James Stauffer wrote:
I believe I have seen examples on the mailing list so there should be
examples in the archive.
On 7/11/07, Hans Schwaebli wrote:
> Come on... You know what I mean. I didn't find any good manual or
tutorial freely available for log4j. And I searched for half an hour.
Excuse me if I then dare to ask here. So if anyone can tell me, I would
be glad.
>
>
> James Stauffer wrote: Did you search the mailing list archives, wiki,
and javadocs?
>
> On 7/11/07, Hans Schwaebli wrote:
> > It seems this is a solution. But I couldn't find a site where using
log4j filters is described. Any idea?
> >
--
James Stauffer http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
---------------------------------
Take the Internet to Go: Yahoo!Go puts the Internet in your pocket:
mail, news, photos & more.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
---------------------------------
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives. Check it out.
RE: Recipients of email appender depending on log message, possible?
Posted by Scott Deboy <sd...@comotivsystems.com>.
BTW, you will be able to use an ExpressionFilter to build regexps that
can evaluate message text, MDC entries, etc (part of a log4j release
soon hopefully).
Scott Deboy
Principal Engineer
COMOTIV SYSTEMS
111 SW Columbia Street Ste. 950
Portland, OR 97201
Office: 503.224.7496
Direct Line: 503.821.6482
Cell: 503.997.1367
Fax: 503.222.0185
sdeboy@comotivsystems.com
www.comotivsystems.com
-----Original Message-----
From: Hans Schwaebli [mailto:hans_schwaebli@yahoo.com]
Sent: Thursday, July 12, 2007 4:42 AM
To: Log4J Users List
Subject: Re: Recipients of email appender depending on log message,
possible?
I think it is no great problem to write a custom filter which reads the
MDC content, although it would take some time to write and to test and
maintain it.
So I rather would like to use a addon or something, if it exists,
which does this.
James Stauffer <st...@gmail.com> wrote:
I believe I have seen examples on the mailing list so there should be
examples in the archive.
On 7/11/07, Hans Schwaebli wrote:
> Come on... You know what I mean. I didn't find any good manual or
tutorial freely available for log4j. And I searched for half an hour.
Excuse me if I then dare to ask here. So if anyone can tell me, I would
be glad.
>
>
> James Stauffer wrote: Did you search the mailing list archives, wiki,
and javadocs?
>
> On 7/11/07, Hans Schwaebli wrote:
> > It seems this is a solution. But I couldn't find a site where using
log4j filters is described. Any idea?
> >
--
James Stauffer http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
---------------------------------
Take the Internet to Go: Yahoo!Go puts the Internet in your pocket:
mail, news, photos & more.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: Recipients of email appender depending on log message, possible?
Posted by James Stauffer <st...@gmail.com>.
Look at the *Filter classes in
http://logging.apache.org/log4j/docs/api/org/apache/log4j/varia/package-summary.html
and then you can search on those class names.
On 7/15/07, David Lloyd <ll...@adam.com.au> wrote:
>
> Well,
>
> http://www.google.com.au/search?q=log4j-user+message+filtering
>
> ...lead me to this:
>
> http://permalink.gmane.org/gmane.comp.jakarta.log4j.user/12341
>
> ...at time of writing that's the second link.
>
> "Route all the events to both file appenders, and specify a different
> ExpressionFilter on each appender."
>
> I looked up "Expression Filters log4j" and they appear to be Log4J 1.3
> specific...
>
> DSL
>
> > I believe I have seen examples on the mailing list so there should be
> > examples in the archive.
> >
> > On 7/11/07, Hans Schwaebli <ha...@yahoo.com> wrote:
> >> Come on... You know what I mean. I didn't find any good manual or
> >> tutorial freely available for log4j. And I searched for half an hour.
> >> Excuse me if I then dare to ask here. So if anyone can tell me, I
> >> would be glad.
> >>
> >>
> >> James Stauffer <st...@gmail.com> wrote: Did you search the
> >> mailing list archives, wiki, and javadocs?
> >>
> >> On 7/11/07, Hans Schwaebli wrote:
> >> > It seems this is a solution. But I couldn't find a site where using
> >> log4j filters is described. Any idea?
> >> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
--
James Stauffer http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: Recipients of email appender depending on log message, possible?
Posted by David Lloyd <ll...@adam.com.au>.
Well,
http://www.google.com.au/search?q=log4j-user+message+filtering
...lead me to this:
http://permalink.gmane.org/gmane.comp.jakarta.log4j.user/12341
...at time of writing that's the second link.
"Route all the events to both file appenders, and specify a different
ExpressionFilter on each appender."
I looked up "Expression Filters log4j" and they appear to be Log4J 1.3
specific...
DSL
> I believe I have seen examples on the mailing list so there should be
> examples in the archive.
>
> On 7/11/07, Hans Schwaebli <ha...@yahoo.com> wrote:
>> Come on... You know what I mean. I didn't find any good manual or
>> tutorial freely available for log4j. And I searched for half an hour.
>> Excuse me if I then dare to ask here. So if anyone can tell me, I
>> would be glad.
>>
>>
>> James Stauffer <st...@gmail.com> wrote: Did you search the
>> mailing list archives, wiki, and javadocs?
>>
>> On 7/11/07, Hans Schwaebli wrote:
>> > It seems this is a solution. But I couldn't find a site where using
>> log4j filters is described. Any idea?
>> >
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: Recipients of email appender depending on log message, possible?
Posted by Hans Schwaebli <ha...@yahoo.com>.
I think it is no great problem to write a custom filter which reads the MDC content, although it would take some time to write and to test and maintain it.
So I rather would like to use a addon or something, if it exists, which does this.
James Stauffer <st...@gmail.com> wrote:
I believe I have seen examples on the mailing list so there should be
examples in the archive.
On 7/11/07, Hans Schwaebli wrote:
> Come on... You know what I mean. I didn't find any good manual or tutorial freely available for log4j. And I searched for half an hour. Excuse me if I then dare to ask here. So if anyone can tell me, I would be glad.
>
>
> James Stauffer wrote: Did you search the mailing list archives, wiki, and javadocs?
>
> On 7/11/07, Hans Schwaebli wrote:
> > It seems this is a solution. But I couldn't find a site where using log4j filters is described. Any idea?
> >
--
James Stauffer http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
---------------------------------
Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more.
Re: Recipients of email appender depending on log message, possible?
Posted by James Stauffer <st...@gmail.com>.
I believe I have seen examples on the mailing list so there should be
examples in the archive.
On 7/11/07, Hans Schwaebli <ha...@yahoo.com> wrote:
> Come on... You know what I mean. I didn't find any good manual or tutorial freely available for log4j. And I searched for half an hour. Excuse me if I then dare to ask here. So if anyone can tell me, I would be glad.
>
>
> James Stauffer <st...@gmail.com> wrote: Did you search the mailing list archives, wiki, and javadocs?
>
> On 7/11/07, Hans Schwaebli wrote:
> > It seems this is a solution. But I couldn't find a site where using log4j filters is described. Any idea?
> >
--
James Stauffer http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: Recipients of email appender depending on log message, possible?
Posted by Hans Schwaebli <ha...@yahoo.com>.
Come on... You know what I mean. I didn't find any good manual or tutorial freely available for log4j. And I searched for half an hour. Excuse me if I then dare to ask here. So if anyone can tell me, I would be glad.
James Stauffer <st...@gmail.com> wrote: Did you search the mailing list archives, wiki, and javadocs?
On 7/11/07, Hans Schwaebli wrote:
> It seems this is a solution. But I couldn't find a site where using log4j filters is described. Any idea?
>
>
> James Stauffer wrote:
> You might be able to achieve that with an appender filter.
>
> On 7/11/07, Hans Schwaebli wrote:
> > I want to send a email depending on the log text. I add the terminal ID to the log text, which is the one of the user who caused the exception, which is logged at error level. Depending on that ID (or a regular expression) I want to send the email to certain recipients.
> >
> > Does this work with log4j configuration out of the box? What is the solution for this?
> >
> >
> > ---------------------------------
> > Yahoo! oneSearch: Finally, mobile search that gives answers, not web links.
>
>
> --
> James Stauffer http://www.geocities.com/stauffer_james/
> Are you good? Take the test at http://www.livingwaters.com/good/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
>
>
> ---------------------------------
> Got a little couch potato?
> Check out fun summer activities for kids.
--
James Stauffer http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
---------------------------------
Building a website is a piece of cake.
Yahoo! Small Business gives you all the tools to get online.
Re: Recipients of email appender depending on log message, possible?
Posted by James Stauffer <st...@gmail.com>.
Did you search the mailing list archives, wiki, and javadocs?
On 7/11/07, Hans Schwaebli <ha...@yahoo.com> wrote:
> It seems this is a solution. But I couldn't find a site where using log4j filters is described. Any idea?
>
>
> James Stauffer <st...@gmail.com> wrote:
> You might be able to achieve that with an appender filter.
>
> On 7/11/07, Hans Schwaebli wrote:
> > I want to send a email depending on the log text. I add the terminal ID to the log text, which is the one of the user who caused the exception, which is logged at error level. Depending on that ID (or a regular expression) I want to send the email to certain recipients.
> >
> > Does this work with log4j configuration out of the box? What is the solution for this?
> >
> >
> > ---------------------------------
> > Yahoo! oneSearch: Finally, mobile search that gives answers, not web links.
>
>
> --
> James Stauffer http://www.geocities.com/stauffer_james/
> Are you good? Take the test at http://www.livingwaters.com/good/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
>
>
> ---------------------------------
> Got a little couch potato?
> Check out fun summer activities for kids.
--
James Stauffer http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: Recipients of email appender depending on log message, possible?
Posted by Hans Schwaebli <ha...@yahoo.com>.
It seems this is a solution. But I couldn't find a site where using log4j filters is described. Any idea?
James Stauffer <st...@gmail.com> wrote:
You might be able to achieve that with an appender filter.
On 7/11/07, Hans Schwaebli wrote:
> I want to send a email depending on the log text. I add the terminal ID to the log text, which is the one of the user who caused the exception, which is logged at error level. Depending on that ID (or a regular expression) I want to send the email to certain recipients.
>
> Does this work with log4j configuration out of the box? What is the solution for this?
>
>
> ---------------------------------
> Yahoo! oneSearch: Finally, mobile search that gives answers, not web links.
--
James Stauffer http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
---------------------------------
Got a little couch potato?
Check out fun summer activities for kids.
Re: Recipients of email appender depending on log message, possible?
Posted by James Stauffer <st...@gmail.com>.
You might be able to achieve that with an appender filter.
On 7/11/07, Hans Schwaebli <ha...@yahoo.com> wrote:
> I want to send a email depending on the log text. I add the terminal ID to the log text, which is the one of the user who caused the exception, which is logged at error level. Depending on that ID (or a regular expression) I want to send the email to certain recipients.
>
> Does this work with log4j configuration out of the box? What is the solution for this?
>
>
> ---------------------------------
> Yahoo! oneSearch: Finally, mobile search that gives answers, not web links.
--
James Stauffer http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: How to always log the host name?
Posted by ben short <be...@benshort.co.uk>.
Sorry scrap that request I have found the info now.
http://www.onjava.com/pub/a/onjava/2002/08/07/log4j.html?page=3
On 7/25/07, ben short <be...@benshort.co.uk> wrote:
> James,
>
> Could you elaborate about the MDC value please. What is it, how do i set it?
>
> Regards
>
> Ben
>
> On 7/5/07, James Stauffer <st...@gmail.com> wrote:
> > I had added the hostname as an MDC value at application startup to achieve that.
> >
> > On 7/4/07, Hans Schwaebli <ha...@yahoo.com> wrote:
> > > How can I configure the log4j logging to add the hostname information into the logging output?
> > >
> > > Most naturally would be to find a conversion character for the hostname in the PatternLayout. But there is none.
> > >
> > >
> > > ---------------------------------
> > > Building a website is a piece of cake.
> > > Yahoo! Small Business gives you all the tools to get online.
> >
> >
> > --
> > James Stauffer http://www.geocities.com/stauffer_james/
> > Are you good? Take the test at http://www.livingwaters.com/good/
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: How to always log the host name?
Posted by ben short <be...@benshort.co.uk>.
James,
Could you elaborate about the MDC value please. What is it, how do i set it?
Regards
Ben
On 7/5/07, James Stauffer <st...@gmail.com> wrote:
> I had added the hostname as an MDC value at application startup to achieve that.
>
> On 7/4/07, Hans Schwaebli <ha...@yahoo.com> wrote:
> > How can I configure the log4j logging to add the hostname information into the logging output?
> >
> > Most naturally would be to find a conversion character for the hostname in the PatternLayout. But there is none.
> >
> >
> > ---------------------------------
> > Building a website is a piece of cake.
> > Yahoo! Small Business gives you all the tools to get online.
>
>
> --
> James Stauffer http://www.geocities.com/stauffer_james/
> Are you good? Take the test at http://www.livingwaters.com/good/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Recipients of email appender depending on log message, possible?
Posted by Hans Schwaebli <ha...@yahoo.com>.
I want to send a email depending on the log text. I add the terminal ID to the log text, which is the one of the user who caused the exception, which is logged at error level. Depending on that ID (or a regular expression) I want to send the email to certain recipients.
Does this work with log4j configuration out of the box? What is the solution for this?
---------------------------------
Yahoo! oneSearch: Finally, mobile search that gives answers, not web links.
Re: How to always log the host name?
Posted by James Stauffer <st...@gmail.com>.
I had added the hostname as an MDC value at application startup to achieve that.
On 7/4/07, Hans Schwaebli <ha...@yahoo.com> wrote:
> How can I configure the log4j logging to add the hostname information into the logging output?
>
> Most naturally would be to find a conversion character for the hostname in the PatternLayout. But there is none.
>
>
> ---------------------------------
> Building a website is a piece of cake.
> Yahoo! Small Business gives you all the tools to get online.
--
James Stauffer http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org