[prev in list] [next in list] [prev in thread] [next in thread] 

List:       log4j-user
Subject:    RE: Logging every package with a different appender
From:       Simon Dorrat <simon.dorrat () gsjbw ! com>
Date:       2004-05-17 23:57:31
Message-ID: 5762848BE35ED511AD2400508BF3A6BB03662396 () meexc05 ! jbwere ! com ! au
[Download RAW message or body]

I think you're mixing the purpose of appenders and levels.  If everything is
going to the console, and has the same layout, then you only need one
appender.  Then for each package you specify a different level to log at (eg
INFO, DEBUG, ERROR etc). And yes, as Alan said, you can specify a package
name, but it must still be fully qualified.

Example: if the fully qualified package names are 
	com.myorg.webapp.servlets
	com.myorg.webapp.beans
then the following should work:

<appender class="ConsoleAppender" name="CONSOLE">
  ......
</appender>

<logger additivity="false" name="com.myorg.webapp.servlets">
   <level value="DEBUG">
   <appender-ref ref="CONSOLE" />
</logger>

<logger additivity="false" name="com.myorg.webapp.beans">
   <level value="INFO">
   <appender-ref ref="CONSOLE" />
</logger>


This will log DEBUG and above events from the com.myorg.webapp.servlets
package, but only INFO and above from the com.myorg.webapp.beans package.

However, if by CONSOLEVERBOSE you actually wanted more information printed
on each line for a particular package (such as source line or something)
rather than just more "lines" printed, then you will need a seperate
appender as you originally had.  But still make sure you use the fully
qualified class name.

Hope this helps.

Simon

> -----Original Message-----
> From:	gfdgdf gdfgdf [SMTP:francis17101970@yahoo.it]
> Sent:	Thursday, 13 May 2004 5:12 PM
> To:	Log4J Users List
> Subject:	RE: Logging every package with a different appender
> 
> Hello, thanks for your answers.
> Well anybody has experience with xml config files ?
> My question is about: can I specify a package as name attribute
> instead of a fully qualified Class name ? my aim is to log every package
> with a different appender as I said.
> As you noticed I have created 2 console appenders (CONSOLE &
> CONSOLEVERBOSE). My purpose is to use one basic console appender for a
> package and a "richer" one for another package (but still on the console).
> 
> So anybody got experience with this ?
> Thanks again
> Francis
> 
> Alan Brown <abrown@opstechnology.com> wrote:
> I don't use the xml configuration file so there may be more errors than
> the ones I mention. However, with that caveat...
> 
> You haven't spelt additivity correctly for one...
> 
> ""
> 
> Also, you appear to have all of the appenders be ConsoleAppenders so it
> would seem natural that they'd all be writing to the same place (the
> console). Perhaps you intend to be using RollingFileAppenders.
> 
> Finally, you need to use the fully qualified class name to make the
> appenders work, so it's hard to imagine that this file would do anything
> for you at all.
> 
> But, as I said, I don't use this format for my config file, so maybe I'm
> wrong...
> 
> alan
> 
> 
> 
> -----Original Message-----
> From: gfdgdf gdfgdf [mailto:francis17101970@yahoo.it] 
> Sent: Wednesday, May 12, 2004 1:47 AM
> To: log4j-user@jakarta.apache.org
> Subject: Logging every package with a different appender
> 
> Hi all log4j users !
> I have a web application that uses several packages:
> 
> webapp.beans
> webapp.servlets
> webapp.customtags
> 
> Now I'd like to use a different appender for every package.
> 
> My log4j.xml file is basically like this:
> 
> 
> ......
> 
> 
> 
> ......
> 
> 
> 
> 
> ......
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Unfortunately I get in the FILE appender also logs from other
> packages....can anybody point out what is wrong with it ?
> Thanks a lot
> Francesco
> 
> 
> ---------------------------------
> Yahoo! Companion - Scarica gratis la toolbar di Ricerca di Yahoo!
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 		
> ---------------------------------
> Yahoo! Companion - Scarica gratis la toolbar di Ricerca di Yahoo!


Goldman Sachs JBWere
Disclosure of Interest
ORG:  Goldman Sachs JBWere and/or its affiliates expect to receive or intend to seek \
compensation for financial and advisory services in the next 3 months from the \
company, its parent, or its wholly owned or majority owned subsidiary.



GOLDMAN SACHS JBWERE PTY LTD DISCLAIMER

Goldman Sachs JBWere Pty Ltd and its related entities distributing this document and \
each of their respective directors, officers and agents ("the Goldman Sachs JBWere \
Group") believe that the information contained in this document is correct and that \
any estimates, opinions, conclusions or recommendations contained in this document \
are reasonably held or made as at the time of compilation.  However, no warranty is \
made as to the accuracy or reliability of any estimates, opinions, conclusions, \
recommendations (which may change without notice) or other information contained in \
this document and, to the maximum extent permitted by law, the Goldman Sachs JBWere \
Group disclaims all liability and responsibility for any direct or indirect loss or \
damage which may be suffered by any recipient through relying on anything contained \
or omitted from this document.

Goldman Sachs JBWere does not represent or warrant the attached files are free from \
computer viruses or other defects.  The attached files are provided, and may only be \
used, on the basis that the user assumes all responsibility for any loss, damage or \
consequence resulting directly or indirectly from use.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic