In your other email you say...
Running command line. From within NetBeans. No fancy stuff.
Never discount the complexity of an IDE and how it forks JVMs and/or performs
idiosyncratic classloading.
In any case, your test below is invalid in this context. You claimed, in an
earlier response, that you load your config manually using...
PropertyConfigurator.configure("./src/logging/log4j.properties");
The output you see from Log4j, ending with the line...
log4j: Could not find resource: [null].
...just means that Log4j default config lookup didn't find a Log4j config file
in the root of the classpath. That's normal if you didn't put it there. But
because you manually configure, your config is loaded, so you can ignore the
above line.
The one odd thing I see is that there is a logger named "jobManager" that is
configured. I don't see that in the log4 config you posted in a previous
response (see below). Are you sure the config file that is being loaded is
the one you **think** is being loaded?
I copy pasted
log4j.rootLogger=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%c] %m%n
log4j.logger.org.apache.http=DEBUG
log4j.logger.org.apache.http.wire=ERROR
Into a file I named log4j.properties that I put into src folder a'ka
<default package>
BTW, why do you configure a properties file from a "src" folder. Why not just
copy that into some folder on the classpath and let Log4j auto-configure.
Besides, your methodology of using...
PropertyConfigurator.configure("./src/logging/log4j.properties");
...suffers from the fact that this is a file path, relative to the directory
from which the JVM started. That is bound to change from environment to
environment and, therefore, brittle. Just stick it in the classpath and let
Log4j pick it up.
Jake
On Tue, 10 Apr 2012 21:29:51 +0200
tommmmmm <tommm...@gmail.com> wrote:
My debug for log4j:
log4j: Trying to find [log4j.xml] using context classloader
sun.misc.Launcher$AppClassLoader@56e88e24.
log4j: Trying to find [log4j.xml] using
sun.misc.Launcher$AppClassLoader@56e88e24 class loader.
log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource().
log4j: Trying to find [log4j.properties] using context classloader
sun.misc.Launcher$AppClassLoader@56e88e24.
log4j: Trying to find [log4j.properties] using
sun.misc.Launcher$AppClassLoader@56e88e24 class loader.
log4j: Trying to find [log4j.properties] using
ClassLoader.getSystemResource().
log4j: Could not find resource: [null].
log4j: Parsing for [root] with value=[DEBUG, stdout].
log4j: Level token is [DEBUG].
log4j: Category root set to DEBUG
log4j: Parsing appender named "stdout".
log4j: Parsing layout options for "stdout".
log4j: Setting property [conversionPattern] to [%5p [%c] %m%n].
log4j: End of parsing for "stdout".
log4j: Parsed "stdout" options.
log4j: Parsing for [org.apache.http.wire] with value=[DEBUG].
log4j: Level token is [DEBUG].
log4j: Category org.apache.http.wire set to DEBUG
log4j: Handling log4j.additivity.org.apache.http.wire=[null]
log4j: Parsing for [org.apache.http] with value=[DEBUG].
log4j: Level token is [DEBUG].
log4j: Category org.apache.http set to DEBUG
log4j: Handling log4j.additivity.org.apache.http=[null]
log4j: Parsing for [jobManager] with value=[DEBUG].
log4j: Level token is [DEBUG].
log4j: Category jobManager set to DEBUG
log4j: Handling log4j.additivity.jobManager=[null]
log4j: Finished configuring.
My output for
System.out.println(httpClient.getClass().getClassLoader().getResource("log4j.properties"));
is: null
It seems the httpClient is not using the logger properties I specified. But
I thought that's why there was this line:
log4j.logger.org.apache.http=DEBUG in the first place.
I am so confused. Any hints?
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org