Re: Filter log based on package when using getLogger(String)

2012-07-18 Thread Charles Hache
Thanks a lot for the tips guys! tl;dr - skip to the end for my final, simple solution. I'm a bit hesitant to adding expression filters to do this filtering. The root of the issue is that I want to set the package log level using the regular, standard way (so that anyone can do it/understand i

RE: PATCH: Extend getLevel documentation

2012-07-18 Thread Aidan Delaney
Dear all, Apparently I'm having a bad day :O The patch is now on github: https://gist.github.com/3138235 -- Aidan Delaney - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4

PATCH: Extend getLevel documentation

2012-07-18 Thread Aidan Delaney
Dear all, The source of my earlier confusion was that I was using Category.getLevel() rather than Category.getEffectiveLevel(). The following is a patch that might allow the next person to resolve this confusion in a shorter timeframe. I've not used SVN in a while, but I believe that this diff is

RE: Initializing log4j in a library

2012-07-18 Thread Aidan Delaney
Dear all, Thank you for your time. It works on a small example, so it looks like I have fouled up my classpath for my larger project. -- Aidan - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional

RE: Initializing log4j in a library

2012-07-18 Thread Douglas E Wegscheid
if you try this, you will find that it will work just fine, provided you have a log4j.properties or log4j.xml around ■ DOUGLAS E. WEGSCHEID // LEAD ENGINEER (269) 923-5278 // douglas_e_wegsch...@whirlpool.com "A wrong note played hesitatingly is a wrong note. A wrong note played with convict

RE: Initializing log4j in a library

2012-07-18 Thread Aidan Delaney
Tim, On Wed, 2012-07-18 at 12:27 -0400, Tim Watts wrote: On Wed, 2012-07-18 at 16:00 +0100, Aidan Delaney wrote: > > >From what I can see, it's best to create a ProjectLogger with a > > static initialiser > >=20 > > public class ProjectLogger { > > static { > > Logger logger =3D Logger.getLog

Re: Filter log based on package when using getLogger(String)

2012-07-18 Thread Scott Deboy
Correction: expression would use the LOGGER instead of MSG, since you're filtering on that. On Wed, Jul 18, 2012 at 10:54 AM, Scott Deboy wrote: > You can use filters, including the ExpressionFilter, to build pretty much > arbitrary expressions and filter appenders using that, but it requires yo

Re: Filter log based on package when using getLogger(String)

2012-07-18 Thread Scott Deboy
You can use filters, including the ExpressionFilter, to build pretty much arbitrary expressions and filter appenders using that, but it requires you to use a log4j.xml configuration file. Something like this (requires you to have the 'extras' companion in your classpath):

Re: Filter log based on package when using getLogger(String)

2012-07-18 Thread Douglas E Wegscheid
Use MDC for the string? ■ DOUGLAS E. WEGSCHEID // LEAD ENGINEER (269) 923-5278 // douglas_e_wegsch...@whirlpool.com "A wrong note played hesitatingly is a wrong note. A wrong note played with conviction is interpretation." Charles Hache 07/18/2012 01:26 PM Please respond to "Log4J Users List

Filter log based on package when using getLogger(String)

2012-07-18 Thread Charles Hache
Hello folks, Most of my loggers are constructed with the Logger.getLogger(String) function, so that I can have loggers like "Device(#3, Some Description)" instead of "ca.something.package.Device" with the goal of being able to more easily identify which instances are writing what log lines.

Re: Initializing log4j in a library

2012-07-18 Thread Tim Watts
On Wed, 2012-07-18 at 16:00 +0100, Aidan Delaney wrote: > Dear all, > I have a bunch of loosely related class files that I distrubute in a > single jar. So, for instance I have Foo.java and Bar.java, where > there is not top-level init() for the library. I also want to use > log4j to replace the

Initializing log4j in a library

2012-07-18 Thread Aidan Delaney
Dear all, I have a bunch of loosely related class files that I distrubute in a single jar. So, for instance I have Foo.java and Bar.java, where there is not top-level init() for the library. I also want to use log4j to replace the antiquated not-quite-logging system that is in this code. I'm