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-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
AW: Path exclusion for logs
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:angeli...@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-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
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:angeli...@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-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@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-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Sharing Appenders between loggers?
log4j.rootLogger = ERROR, stdout log4j.logger.org.jboss = DEBUG, A1 log4j.logger.ca.xyz = INFO, A1 A1 is a DaylyRollingFileAppender. Just wondering of both logers can use the same A1 appender. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
AW: AW: Path exclusion for logs
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:angeli...@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:angeli...@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-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@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-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: Sharing Appenders between loggers?
Yes, appenders can be attached at multiple places in the hierarchy. An appender can also be attached multiple times to the same logger or on two different levels of the hierarchy (for example if you attached A1 to the rootLogger), both of which can result in an appender processing the same event multiple times. On Mar 18, 2010, at 10:01 AM, Tasso Angelidis wrote: log4j.rootLogger = ERROR, stdout log4j.logger.org.jboss = DEBUG, A1 log4j.logger.ca.xyz = INFO, A1 A1 is a DaylyRollingFileAppender. Just wondering of both logers can use the same A1 appender. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org