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 Thomas Saxtoft <TS...@sondagsavisen.dk> on 2002/07/03 12:00:03 UTC

Newbie filtering

Hi

I have recently started to use Log4j, and now I have encountered some
issues that I can not find an answer for.

Firstly I can not find any where a description of how to configure Log4j
using a XML file instead of a property file.

Secondly I would like to filter my output, in a way that only shows me
messages that I am interested in at the moment.
In the project I am working on, we are four developers. Using Log4j all
of us, I would get the debug messages from my colleagues and vice versa.
I also get messages from classes that I am not debugging at the moment.
With all these messages the output tends to be pretty crowded. How can I
filter the output?

Thomas Saxtoft

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Newbie filtering

Posted by Thomas Muller <tt...@online.no>.
 | Firstly I can not find any where a description of how to configure Log4j
 | using a XML file instead of a property file.

You will find examples in the
LOG4j_HOME/src/java/org/apache/log4j/xml/examples. Also have a look at the
LOG4j_HOME/src/java/org/apache/log4j/xml/log4j.dtd file.

 | Secondly I would like to filter my output, in a way that only shows me
 | messages that I am interested in at the moment.
 | In the project I am working on, we are four developers. Using Log4j all
 | of us, I would get the debug messages from my colleagues and vice versa.
 | I also get messages from classes that I am not debugging at the moment.
 | With all these messages the output tends to be pretty crowded. How can I
 | filter the output?

Seems like you have a CM issue. However, log4j is very flexible, I'm sure
you will find a solution when you understand the hierarchical Logger
relationship, and how Loggers and Appenders interrelate. See the manual for
this. Take a look at NDC and MDC as well, it might be something you can use
from these concepts.

--

Thomas



*************************************************************************
Copyright ERA Technology Ltd. 2002. (www.era.co.uk). All rights reserved. 
The information supplied in this email should be treated in confidence.
No liability whatsoever is accepted for any loss or damage 
suffered as a result of accessing this message or any attachments.

________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.messagelabs.com
________________________________________________________________________

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Newbie filtering

Posted by Colin MacDonald <co...@templarcorp.com>.
> -----Original Message-----
> 
> Firstly I can not find any where a description of how to configure Log4j
> using a XML file instead of a property file.

Yeah, I've been wondering about that, too.  Can't say I've put too
much work into figuring it out, though.

> Secondly I would like to filter my output, in a way that only shows me
> messages that I am interested in at the moment.
> In the project I am working on, we are four developers. Using Log4j all
> of us, I would get the debug messages from my colleagues and vice versa.
> I also get messages from classes that I am not debugging at the moment.
> With all these messages the output tends to be pretty crowded. How can I
> filter the output?

Well, assuming you're all working on different machines, set up
different log4j config files for each developer.

At my company, we do this by having different classpaths for each
machine, so that different log4j.properties files get picked up.
On Windows, this is done with lines like this in one of our run
scripts:

set CLASSPATH=%CLASSPATH%;properties\%COMPUTERNAME%
set CLASSPATH=%CLASSPATH%;properties

You can do the same thing on unix with $HOSTNAME.
The properties directory has common properties, and
properties\%COMPUTERNAME% has machine-specific ones.  With the
path in this order, the machine-specific properties get picked
up first.

-----------------------------------------------------------------
Colin MacDonald  |  Software Developer  |  Templar Corporation  |
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.373 / Virus Database: 208 - Release Date: 7/1/2002


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>