Re: Translating log levels
It seems like I would have to implement a custom RewitePolicy to accomplish this, none of the two bundled RewritePolicies can do this. On Tue, May 19, 2015 at 10:38 PM, Gary Gregory garydgreg...@gmail.com wrote: Do you need a custom RewritePolicy? Gary Original message From: Ralph Goers ralph.go...@dslextreme.com Date: 05/19/2015 10:50 (GMT-08:00) To: Log4J Users List log4j-user@logging.apache.org Subject: Re: Translating log levels I am assuming you want the Level in the output to say WARN instead of ERROR - otherwise simple filtering at the Logger would get you the output. You can use the RewriteAppender to modify the Level to what you want. Ralph On May 19, 2015, at 8:10 AM, Mikael Ståldal mikael.stal...@magine.com wrote: Is it possible to translate log levels in the configuration. I have some 3rd party libraries who log stuff on too high level, so I would need a way to say that logging from com.somecompany.funlibrary on level ERROR should be translated to WARN. -- [image: MagineTV] *Mikael Ståldal* Senior backend developer *Magine TV* mikael.stal...@magine.com Regeringsgatan 25 | 111 53 Stockholm, Sweden | www.magine.com Privileged and/or Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such a person), you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply email. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org -- [image: MagineTV] *Mikael Ståldal* Senior backend developer *Magine TV* mikael.stal...@magine.com Regeringsgatan 25 | 111 53 Stockholm, Sweden | www.magine.com Privileged and/or Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such a person), you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply email.
Re: Translating log levels
I created a JIRA issue for this: https://issues.apache.org/jira/browse/LOG4J2-1023 On Wed, May 20, 2015 at 10:09 AM, Mikael Ståldal mikael.stal...@magine.com wrote: It seems like I would have to implement a custom RewitePolicy to accomplish this, none of the two bundled RewritePolicies can do this. On Tue, May 19, 2015 at 10:38 PM, Gary Gregory garydgreg...@gmail.com wrote: Do you need a custom RewritePolicy? Gary Original message From: Ralph Goers ralph.go...@dslextreme.com Date: 05/19/2015 10:50 (GMT-08:00) To: Log4J Users List log4j-user@logging.apache.org Subject: Re: Translating log levels I am assuming you want the Level in the output to say WARN instead of ERROR - otherwise simple filtering at the Logger would get you the output. You can use the RewriteAppender to modify the Level to what you want. Ralph On May 19, 2015, at 8:10 AM, Mikael Ståldal mikael.stal...@magine.com wrote: Is it possible to translate log levels in the configuration. I have some 3rd party libraries who log stuff on too high level, so I would need a way to say that logging from com.somecompany.funlibrary on level ERROR should be translated to WARN. -- [image: MagineTV] *Mikael Ståldal* Senior backend developer *Magine TV* mikael.stal...@magine.com Regeringsgatan 25 | 111 53 Stockholm, Sweden | www.magine.com Privileged and/or Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such a person), you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply email. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org -- [image: MagineTV] *Mikael Ståldal* Senior backend developer *Magine TV* mikael.stal...@magine.com Regeringsgatan 25 | 111 53 Stockholm, Sweden | www.magine.com Privileged and/or Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such a person), you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply email. -- [image: MagineTV] *Mikael Ståldal* Senior backend developer *Magine TV* mikael.stal...@magine.com Regeringsgatan 25 | 111 53 Stockholm, Sweden | www.magine.com Privileged and/or Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such a person), you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply email.
Re: Translating log levels
You can use loggers and filters (see org.apache.logging.log4j.core.filter.DynamicThresholdFilter, ThresholdFilter and others) to only log what you want but I am pretty sure you cannot change the level of a message in flight. A custom org.apache.logging.log4j.message.MessageFactory would do it since it does not take a Level... Patches welcome? :-) What would a sample configuration look like? Gary On Tue, May 19, 2015 at 8:10 AM, Mikael Ståldal mikael.stal...@magine.com wrote: Is it possible to translate log levels in the configuration. I have some 3rd party libraries who log stuff on too high level, so I would need a way to say that logging from com.somecompany.funlibrary on level ERROR should be translated to WARN. -- [image: MagineTV] *Mikael Ståldal* Senior backend developer *Magine TV* mikael.stal...@magine.com Regeringsgatan 25 | 111 53 Stockholm, Sweden | www.magine.com Privileged and/or Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such a person), you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply email. -- E-Mail: garydgreg...@gmail.com | ggreg...@apache.org Java Persistence with Hibernate, Second Edition http://www.manning.com/bauer3/ JUnit in Action, Second Edition http://www.manning.com/tahchiev/ Spring Batch in Action http://www.manning.com/templier/ Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory
Translating log levels
Is it possible to translate log levels in the configuration. I have some 3rd party libraries who log stuff on too high level, so I would need a way to say that logging from com.somecompany.funlibrary on level ERROR should be translated to WARN. -- [image: MagineTV] *Mikael Ståldal* Senior backend developer *Magine TV* mikael.stal...@magine.com Regeringsgatan 25 | 111 53 Stockholm, Sweden | www.magine.com Privileged and/or Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such a person), you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply email.
Re: Translating log levels
Do you need a custom RewritePolicy? Gary Original message From: Ralph Goers ralph.go...@dslextreme.com Date: 05/19/2015 10:50 (GMT-08:00) To: Log4J Users List log4j-user@logging.apache.org Subject: Re: Translating log levels I am assuming you want the Level in the output to say WARN instead of ERROR - otherwise simple filtering at the Logger would get you the output. You can use the RewriteAppender to modify the Level to what you want. Ralph On May 19, 2015, at 8:10 AM, Mikael Ståldal mikael.stal...@magine.com wrote: Is it possible to translate log levels in the configuration. I have some 3rd party libraries who log stuff on too high level, so I would need a way to say that logging from com.somecompany.funlibrary on level ERROR should be translated to WARN. -- [image: MagineTV] *Mikael Ståldal* Senior backend developer *Magine TV* mikael.stal...@magine.com Regeringsgatan 25 | 111 53 Stockholm, Sweden | www.magine.com Privileged and/or Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such a person), you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply email. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: Translating log levels
I am assuming you want the Level in the output to say WARN instead of ERROR - otherwise simple filtering at the Logger would get you the output. You can use the RewriteAppender to modify the Level to what you want. Ralph On May 19, 2015, at 8:10 AM, Mikael Ståldal mikael.stal...@magine.com wrote: Is it possible to translate log levels in the configuration. I have some 3rd party libraries who log stuff on too high level, so I would need a way to say that logging from com.somecompany.funlibrary on level ERROR should be translated to WARN. -- [image: MagineTV] *Mikael Ståldal* Senior backend developer *Magine TV* mikael.stal...@magine.com Regeringsgatan 25 | 111 53 Stockholm, Sweden | www.magine.com Privileged and/or Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such a person), you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply email. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org