log4j question  
Author Message
Ed Thompson





PostPosted: 2004-2-13 5:51:00 Top

java-programmer, log4j question Is log4j specifically a servlet, or is it an API that can be called from
ANY java program that wanst to do logging?
 
Eric Bodden





PostPosted: 2004-2-13 6:18:00 Top

java-programmer >> log4j question Once upon a time <fzSWb.6372$email***@***.com>,
Ed Thompson <email***@***.com> enriched the world with the
following:

> Is log4j specifically a servlet, or is it an API that can be called
> from ANY java program that wanst to do logging?
It's the latter.

Eric

--
-----------------------------------------------------------------
Eric Bodden
ICQ UIN: 12656220
Website: http://www.bodden.de
PGP key available


 
Joona I Palaste





PostPosted: 2005-1-10 4:38:00 Top

java-programmer >> log4j question Suppose I make my own implementation of org.apache.log4j.Level. Call it
FOOBAR.

Now in the style of the Log4J example configuration file (to be parsed
with PropertyConfigurator):

log4j.rootLogger=DEBUG, A1
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout

# Print the date in ISO 8601 format
log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n

# Print only messages of level WARN or above in the package com.foo.
log4j.logger.com.foo=WARN

Can I somehow change the last line to:
log4j.logger.com.foo=FOOBAR

and expect logs from com.foo or its subloggers come at level FOOBAR or
above?

--
/-- Joona Palaste (email***@***.com) ------------- Finland --------\
\-------------------------------------------------------- rules! --------/
"O pointy birds, O pointy-pointy. Anoint my head, anointy-nointy."
- Dr. Michael Hfuhruhurr
 
 
Ryan Stewart





PostPosted: 2005-1-10 20:49:00 Top

java-programmer >> log4j question "Joona I Palaste" <email***@***.com> wrote in message
news:crs4ms$erj$email***@***.com...
> Suppose I make my own implementation of org.apache.log4j.Level. Call it
> FOOBAR.
>
> Now in the style of the Log4J example configuration file (to be parsed
> with PropertyConfigurator):
>
> log4j.rootLogger=DEBUG, A1
> log4j.appender.A1=org.apache.log4j.ConsoleAppender
> log4j.appender.A1.layout=org.apache.log4j.PatternLayout
>
> # Print the date in ISO 8601 format
> log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
>
> # Print only messages of level WARN or above in the package com.foo.
> log4j.logger.com.foo=WARN
>
> Can I somehow change the last line to:
> log4j.logger.com.foo=FOOBAR
>
> and expect logs from com.foo or its subloggers come at level FOOBAR or
> above?
>
I think for custom levels you're supposed to use:
log4j.logger.com.foo=level#com.foo.FooBar

where com.foo.FooBar is the full class name. Never tried it myself though.


 
 
Ryan Stewart





PostPosted: 2005-1-10 21:01:00 Top

java-programmer >> log4j question "Ryan Stewart" <email***@***.com> wrote in message
news:email***@***.com...
> "Joona I Palaste" <email***@***.com> wrote in message
> news:crs4ms$erj$email***@***.com...
>> Suppose I make my own implementation of org.apache.log4j.Level. Call it
>> FOOBAR.
>>
>> Now in the style of the Log4J example configuration file (to be parsed
>> with PropertyConfigurator):
>>
>> log4j.rootLogger=DEBUG, A1
>> log4j.appender.A1=org.apache.log4j.ConsoleAppender
>> log4j.appender.A1.layout=org.apache.log4j.PatternLayout
>>
>> # Print the date in ISO 8601 format
>> log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
>>
>> # Print only messages of level WARN or above in the package com.foo.
>> log4j.logger.com.foo=WARN
>>
>> Can I somehow change the last line to:
>> log4j.logger.com.foo=FOOBAR
>>
>> and expect logs from com.foo or its subloggers come at level FOOBAR or
>> above?
>>
> I think for custom levels you're supposed to use:
> log4j.logger.com.foo=level#com.foo.FooBar
>
> where com.foo.FooBar is the full class name. Never tried it myself though.
Woops, sorry. I went off on a tangent in my own mind and ended up answering the
wrong question. That's obviously how you use custom *loggers*. I'm not sure
about the level thing. Have you tried it yet? What were your results?