logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bender Heri <hben...@ergonomics.ch>
Subject AW: AW: Path exclusion for logs
Date Thu, 18 Mar 2010 15:18:03 GMT
Either:
   you patch the apache class yourself or submit a bug to its developers (or both)
Or:
   you implement a workaround:
      - exclude the path of your own class (like it is seen by the apache getClass():
          <logger name="my.company.HttpClient" additivity="false">
              <level value="off"/>
          </logger>
      - instantiate your own logger with an artificial addendum in the name:   
          private final static Log log = LogFactory.getLog( "my.company.reallyMy.HttpClient"
);
          and configure it like:
          <logger name="my.company.reallyMy.HttpClient">
              <level value="debug"/>
          </logger>
   remember: the name of the logger is just a name. Using the package/Classname is just a
convention and not a must.

Or - of course - both.

Heri

-----Ursprüngliche Nachricht-----
Von: Angeli106 [mailto:angeli106@gmail.com] 
Gesendet: Donnerstag, 18. März 2010 15:51
An: log4j-user@logging.apache.org
Betreff: Re: AW: Path exclusion for logs


Turns out u were right, the parent class(AbstractHttpClient) instantiates the log like this:
private final Log log = LogFactory.getLog(getClass());

Also turns out that this is a commons.logging logger and not a log4j as i thought Also it
looks like it's private so i can't override it, any ideas?




Bender Heri wrote:
> 
> Probably the parent class does not instantiate his logger statically 
> but like this:
> 
> Logger logger = Logger.getLogger( this.getClass().getName() );
> 
> and therefore it retrieves a logger with the name of your descendant 
> (name starting with your namespace). If it would instantiate it statically:
> 
> static Logger logger = Logger.getLogger( org.apache. 
> ..ApacheParent.class );
> 
> then the name of the logger would start with "org.apache. .." and 
> would be excluded if you have a corresponding configuration.
> 
> Just a guess. If this is not the case, you should submit your config 
> file for further analyzis.
> 
> Heri
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: Angeli106 [mailto:angeli106@gmail.com]
> Gesendet: Donnerstag, 18. März 2010 14:50
> An: log4j-user@logging.apache.org
> Betreff: Path exclusion for logs
> 
> 
> Hi,
> 
> I have a java class inheriting from an apache class file. The apache 
> class file is packaged in org.apache... and such i do not see the logs 
> for it, which is great. However, my own class is within my namespace 
> (which i'm
> logging) and as such it now writes the logs of the parent class.. my 
> question is, can i exclude certain paths from the log? (such as the 
> path for the class that i've inherited)
> 
> --
> View this message in context:
> http://old.nabble.com/Path-exclusion-for-logs-tp27945800p27945800.html
> Sent from the Log4j - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> 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
> 
> 
> 

--
View this message in context: http://old.nabble.com/Path-exclusion-for-logs-tp27945800p27946728.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
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


Mime
View raw message