logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Douglas E Wegscheid <Douglas_E_Wegsch...@whirlpool.com>
Subject Re: Log4J doesn't work at all
Date Wed, 11 Apr 2012 21:22:25 GMT
woho! slf4j is in there! you have 2 copies of a slf4j binding loaded, one 
in the slf4j jar, one in the selenium jar. slf4j docs say it should use 
the first one found, which means slf should be binding to log4j. slf4j may 
be catching all the common-logging messages. 

You have a mess here: multiple versions of the same classes loading from 
different jars (httpclient, slf4j, commons logging). I wouldn't even 
hazard how to fix it with things in such disarray. Jacob was right: "it's 
usually a classpath problem". Eliminating the duplicate jars (if you are 
using slf4j, the only commons-logging jar you need is 
commons-logging-api). I don't know how to keep the slf4j configuration 
bundled into the selenium jar from  bunging up everything else. 

It's not HttpComponents that has the problem, and log4j is working just 
fine.  I'd take it to the slf4j list if you continue to have problems...

■ DOUGLAS E. WEGSCHEID // LEAD ENGINEER
(269) 923-5278 // Douglas_E_Wegscheid@whirlpool.com
"A wrong note played hesitatingly is a wrong note. A wrong note played 
with conviction is interpretation."

tommmmmm <tommmmmm@gmail.com> wrote on 04/11/2012 01:55:20 PM:

> On 11 April 2012 18:45, tommmmmm <tommmmmm@gmail.com> wrote:
> 
> > I used the old project I had in my Projects list. And it works there
> > flawlessly.
> >
> > For easier readability here are the results:
> >
> > Log4j configuration debug output in working project:
> > **Start of LogManager static initializer
> > *** configurationOptionStr=null
> > ** End of LogManager static initializer
> > DEBUG [org.apache.log4j.PropertyConfigurator] Parsing for [root] with
> > value=[DEBUG, stdout].
> > DEBUG [org.apache.log4j.PropertyConfigurator] Level token is [DEBUG].
> > DEBUG [org.apache.log4j.PropertyConfigurator] Category root set to 
DEBUG.
> > DEBUG [org.apache.log4j.PropertyConfigurator] Parsing appender named
> > "stdout".
> > DEBUG [org.apache.log4j.PropertyConfigurator] Parsing layout options 
for
> > "stdout".
> > DEBUG [org.apache.log4j.config.PropertySetter] Setting property
> > [conversionPattern] to [%5p [%c] %m%n].
> > DEBUG [org.apache.log4j.PropertyConfigurator] End of parsing for 
"stdout".
> > DEBUG [org.apache.log4j.PropertyConfigurator] Parsed "stdout" options.
> > DEBUG [org.apache.log4j.PropertyConfigurator] Parsing for
> > [org.apache.http.wire] with value=[DEBUG].
> > DEBUG [org.apache.log4j.PropertyConfigurator] Level token is [DEBUG].
> > DEBUG [org.apache.log4j.PropertyConfigurator] Category
> > org.apache.http.wire set to DEBUG.
> > DEBUG [org.apache.log4j.PropertyConfigurator] Handling
> > log4j.additivity.org.apache.http.wire=[null]
> > DEBUG [org.apache.log4j.PropertyConfigurator] Parsing for
> > [org.apache.http] with value=[DEBUG].
> > DEBUG [org.apache.log4j.PropertyConfigurator] Level token is [DEBUG].
> > DEBUG [org.apache.log4j.PropertyConfigurator] Category org.apache.http 
set
> > to DEBUG.
> > DEBUG [org.apache.log4j.PropertyConfigurator] Handling
> > log4j.additivity.org.apache.http=[null]
> > DEBUG [org.apache.log4j.PropertyConfigurator] Parsing for 
[stupidClass]
> > with value=[DEBUG].
> > DEBUG [org.apache.log4j.PropertyConfigurator] Level token is [DEBUG].
> > DEBUG [org.apache.log4j.PropertyConfigurator] Category stupidClass set 
to
> > DEBUG.
> > DEBUG [org.apache.log4j.PropertyConfigurator] Handling
> > log4j.additivity.stupidClass=[null]
> > DEBUG [org.apache.log4j.PropertyConfigurator] Parsing for [jobManager]
> > with value=[DEBUG].
> > DEBUG [org.apache.log4j.PropertyConfigurator] Level token is [DEBUG].
> > DEBUG [org.apache.log4j.PropertyConfigurator] Category jobManager set 
to
> > DEBUG.
> > DEBUG [org.apache.log4j.PropertyConfigurator] Handling
> > log4j.additivity.jobManager=[null]
> > DEBUG [org.apache.log4j.PropertyConfigurator] Finished configuring.
> >
> > Log4j configuration debug output in NOT working project:
> > log4j: Trying to find [log4j.xml] using context classloader
> > sun.misc.Launcher$AppClassLoader@2827f394.
> > log4j: Trying to find [log4j.xml] using
> > sun.misc.Launcher$AppClassLoader@2827f394 class loader.
> > log4j: Trying to find [log4j.xml] using 
ClassLoader.getSystemResource().
> > log4j: Trying to find [log4j.properties] using context classloader
> > sun.misc.Launcher$AppClassLoader@2827f394.
> > log4j: Using URL
> > [file:/home/min/ucng/ucng_java/sBorgJava/src/logging/log4j.properties] 
for
> > automatic log4j configuration.
> > log4j: Reading configuration from URL
> > file:/home/min/ucng/ucng_java/sBorgJava/src/logging/log4j.properties
> > 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 [stupidClass] with value=[DEBUG].
> > log4j: Level token is [DEBUG].
> > log4j: Category stupidClass set to DEBUG
> > log4j: Handling log4j.additivity.stupidClass=[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.
> > 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 [stupidClass] with value=[DEBUG].
> > log4j: Level token is [DEBUG].
> > log4j: Category stupidClass set to DEBUG
> > log4j: Handling log4j.additivity.stupidClass=[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.
> >
> > Classpath in working project:
> > 
/home/min/netbeans-7.1.1/java/modules/ext/toplink/toplink-essentials.jar
> >
> > /home/min/netbeans-7.1.1/java/modules/ext/toplink/toplink-
> essentials-agent.jar
> >
> > 
/home/min/netbeans-7.0.1/ide/modules/ext/mysql-connector-java-5.1.13-bin.jar
> > /home/min/netbeans-7.1.1/java/modules/ext/beansbinding-1.2.1.jar
> > /home/min/ucng/javaLibs/eclipselink-2.3.2/jlib/eclipselink.jar
> >
> > /home/min/netbeans-7.1.1/java/modules/ext/eclipselink/javax.
> persistence-2.0.jar
> >
> > /home/min/netbeans-7.1.1/java/modules/ext/eclipselink/org.eclipse.
> persistence.jpa.jpql_1.0.0.jar
> > /home/min/ucng/javaLibs/htmlunit-2.9/lib/commons-codec-1.4.jar
> > /home/min/ucng/javaLibs/htmlunit-2.9/lib/commons-collections-3.2.1.jar
> > /home/min/ucng/javaLibs/htmlunit-2.9/lib/commons-io-2.0.1.jar
> > /home/min/ucng/javaLibs/htmlunit-2.9/lib/commons-lang-2.6.jar
> > /home/min/ucng/javaLibs/htmlunit-2.9/lib/commons-logging-1.1.1.jar
> > /home/min/ucng/javaLibs/htmlunit-2.9/lib/cssparser-0.9.5.jar
> > /home/min/ucng/javaLibs/htmlunit-2.9/lib/htmlunit-2.9.jar
> > /home/min/ucng/javaLibs/htmlunit-2.9/lib/htmlunit-core-js-2.9.jar
> > /home/min/ucng/javaLibs/htmlunit-2.9/lib/httpclient-4.1.2.jar
> > /home/min/ucng/javaLibs/htmlunit-2.9/lib/httpcore-4.1.2.jar
> > /home/min/ucng/javaLibs/htmlunit-2.9/lib/httpmime-4.1.2.jar
> > /home/min/ucng/javaLibs/htmlunit-2.9/lib/nekohtml-1.9.15.jar
> > /home/min/ucng/javaLibs/htmlunit-2.9/lib/sac-1.3.jar
> > /home/min/ucng/javaLibs/htmlunit-2.9/lib/serializer-2.7.1.jar
> > /home/min/ucng/javaLibs/htmlunit-2.9/lib/xalan-2.7.1.jar
> > /home/min/ucng/javaLibs/htmlunit-2.9/lib/xercesImpl-2.9.1.jar
> > /home/min/ucng/javaLibs/htmlunit-2.9/lib/xml-apis-1.3.04.jar
> > /home/min/netbeans-7.1.1/platform/modules/ext/junit-4.10.jar
> > /home/min/netbeans-7.1.1/enterprise/modules/ext/javaee-api-6.0.jar
> > /home/min/netbeans-7.1.1/enterprise/modules/ext/javaee-web-api-6.0.jar
> >
> > /home/min/netbeans-7.1.1/enterprise/modules/ext/javaee6-
> endorsed/javax.annotation.jar
> >
> > /home/min/netbeans-7.1.1/enterprise/modules/ext/javaee6-
> endorsed/jaxb-api-osgi.jar
> >
> > /home/min/netbeans-7.1.1/enterprise/modules/ext/javaee6-
> endorsed/webservices-api-osgi.jar
> > /home/min/netbeans-7.1.1/java/modules/ext/AbsoluteLayout.jar
> > 
/home/min/workspace/JDownloader/build/newBuild/update/dist/JDownloader.jar
> > /home/min/ucng/javaLibs/json-lib-2.4-jdk15-javadoc.jar
> > /home/min/ucng/javaLibs/json-lib-2.4-jdk15.jar
> > /home/min/ucng/javaLibs/ezmorph-1.0.6.jar
> > 
/home/min/ucng/javaLibs/commons-logging-1.1.1/commons-logging-1.1.1.jar
> >
> > /home/min/ucng/javaLibs/commons-logging-1.1.1/commons-logging-
> adapters-1.1.1.jar
> > 
/home/min/ucng/javaLibs/commons-logging-1.1.1/commons-logging-api-1.1.1.jar
> > 
/home/min/ucng/javaLibs/commons-beanutils-1.8.3/commons-beanutils-1.8.3.jar
> >
> > /home/min/ucng/javaLibs/commons-beanutils-1.8.3/commons-beanutils-
> bean-collections-1.8.3.jar
> >
> > /home/min/ucng/javaLibs/commons-beanutils-1.8.3/commons-beanutils-
> core-1.8.3.jar
> >
> > /home/min/ucng/javaLibs/commons-collections-3.2.1/commons-
> collections-3.2.1.jar
> > /home/min/ucng/javaLibs/xom-1.2.7.jar
> > /home/min/ucng/javaLibs/chainsaw-bundle/jakarta-oro-2.0.6.jar
> > /home/min/ucng/javaLibs/chainsaw-bundle/jmdns.jar
> > /home/min/ucng/javaLibs/chainsaw-bundle/log4j-1.3alpha-7.jar
> > /home/min/ucng/javaLibs/chainsaw-bundle/log4j-chainsaw-2.0alpha-1.jar
> > /home/min/ucng/javaLibs/chainsaw-bundle/log4j-optional-1.3alpha-7.jar
> > /home/min/ucng/javaLibs/chainsaw-bundle/log4j-oro-1.3alpha-7.jar
> > /home/min/ucng/javaLibs/chainsaw-bundle/log4j-smtp-1.3alpha-7.jar
> > /home/min/ucng/javaLibs/chainsaw-bundle/log4j-xml-1.3alpha-7.jar
> > /home/min/ucng/javaLibs/chainsaw-bundle/log4j-zeroconf.jar
> > /home/min/ucng/javaLibs/chainsaw-bundle/xstream-1.1.2.jar
> > /home/min/ucng/javaLibs/groovy-1.8.6/embeddable/groovy-all-1.8.6.jar
> > /home/min/ucng/ucng_java/UCNG/build/classes/
> >
> > Classpath in NOT working project:
> > /home/min/ucng/ucng_java/sBorgJava/src/logging/
> >
> > /home/min/ucng/javaLibs/httpcomponents-client-4.1.3/lib/commons-
> codec-1.4.jar
> >
> > /home/min/ucng/javaLibs/httpcomponents-client-4.1.3/lib/commons-
> logging-1.1.1.jar
> >
> > 
/home/min/ucng/javaLibs/httpcomponents-client-4.1.3/lib/httpclient-4.1.3.jar
> >
> > /home/min/ucng/javaLibs/httpcomponents-client-4.1.
> 3/lib/httpclient-cache-4.1.3.jar
> > 
/home/min/ucng/javaLibs/httpcomponents-client-4.1.3/lib/httpcore-4.1.4.jar
> > 
/home/min/ucng/javaLibs/httpcomponents-client-4.1.3/lib/httpmime-4.1.3.jar
> > 
/home/min/ucng/javaLibs/httpcomponents-client-4.1.3/lib/log4j-1.2.16.jar
> > 
/home/min/ucng/javaLibs/commons-codec-1.6/commons-codec-1.6-javadoc.jar
> > /home/min/ucng/javaLibs/commons-codec-1.6/commons-codec-1.6-tests.jar
> > /home/min/ucng/javaLibs/commons-codec-1.6/commons-codec-1.6.jar
> > /home/min/ucng/javaLibs/selenium-server-standalone-2.20.0.jar
> > /home/min/ucng/javaLibs/scribe-1.3.0.jar
> > /home/min/ucng/javaLibs/pbapi-full-1.4.0.91/dist/pbapi-j2se.jar
> >
> > /home/min/ucng/javaLibs/pbapi-full-1.4.0.
> 91/dist/lib/default/apache-mime4j-0.6.jar
> >
> > /home/min/ucng/javaLibs/pbapi-full-1.4.0.
> 91/dist/lib/default/commons-codec-1.3.jar
> >
> > /home/min/ucng/javaLibs/pbapi-full-1.4.0.
> 91/dist/lib/default/commons-codec-1.4.jar
> >
> > /home/min/ucng/javaLibs/pbapi-full-1.4.0.
> 91/dist/lib/default/commons-lang-2.4.jar
> >
> > /home/min/ucng/javaLibs/pbapi-full-1.4.0.
> 91/dist/lib/default/commons-logging-1.1.1.jar
> >
> > /home/min/ucng/javaLibs/pbapi-full-1.4.0.
> 91/dist/lib/default/commons-validator-1.3.1.jar
> >
> > /home/min/ucng/javaLibs/pbapi-full-1.4.0.
> 91/dist/lib/default/httpclient-4.0.jar
> >
> > /home/min/ucng/javaLibs/pbapi-full-1.4.0.
> 91/dist/lib/default/httpclient-4.1.3.jar
> >
> > /home/min/ucng/javaLibs/pbapi-full-1.4.0.
> 91/dist/lib/default/httpclient-cache-4.1.3.jar
> >
> > /home/min/ucng/javaLibs/pbapi-full-1.4.0.
> 91/dist/lib/default/httpcore-4.0.1.jar
> >
> > /home/min/ucng/javaLibs/pbapi-full-1.4.0.
> 91/dist/lib/default/httpcore-4.1.4.jar
> >
> > /home/min/ucng/javaLibs/pbapi-full-1.4.0.
> 91/dist/lib/default/httpmime-4.0.jar
> >
> > /home/min/ucng/javaLibs/pbapi-full-1.4.0.
> 91/dist/lib/default/httpmime-4.1.3.jar
> >
> > /home/min/ucng/javaLibs/pbapi-full-1.4.0.91/dist/lib/default/jcip-
> annotations-1.0.jar
> > 
/home/min/ucng/javaLibs/pbapi-full-1.4.0.91/dist/lib/default/json-1.0.jar
> >
> > 
/home/min/ucng/javaLibs/pbapi-full-1.4.0.91/dist/lib/default/junit-4.9b2.jar
> >
> > /home/min/ucng/javaLibs/pbapi-full-1.4.0.
> 91/dist/lib/default/log4j-1.2.16.jar
> >
> > /home/min/ucng/javaLibs/pbapi-full-1.4.0.
> 91/dist/lib/default/signpost-commonshttp4-1.2.1.1.jar
> >
> > /home/min/ucng/javaLibs/pbapi-full-1.4.0.
> 91/dist/lib/default/signpost-commonshttp4-1.2.1.2.jar
> >
> > /home/min/ucng/javaLibs/pbapi-full-1.4.0.
> 91/dist/lib/default/signpost-core-1.2.1.1.jar
> >
> > /home/min/ucng/javaLibs/pbapi-full-1.4.0.
> 91/dist/lib/default/signpost-core-1.2.1.2.jar
> >
> > /home/min/ucng/javaLibs/pbapi-full-1.4.0.
> 91/dist/lib/default/signpost-jetty6-1.2.1.2.jar
> >
> > /home/min/ucng/javaLibs/pbapi-full-1.4.0.
> 91/dist/lib/default/slf4j-api-1.6.1.jar
> >
> > /home/min/ucng/javaLibs/pbapi-full-1.4.0.
> 91/dist/lib/default/slf4j-log4j12-1.6.1.jar
> > /home/min/ucng/ucng_java/sBorgJava/build/classes/
> >
> > Lines of code used in working project:
> > System.setProperty("log4j.debug", "true");
> > PropertyConfigurator.configure("./../sBorgJava/src/logging/log4j.
> properties");
> > // <- notice the ./../ (points to same file)
> >
> > Lines of code used in NOT working project:
> > 50+. Various. For the sake of it, I commented out everything except
> > System.setProperty("log4j.debug", "true");
> > 
PropertyConfigurator.configure("./sBorgJava/src/logging/log4j.properties");
> > // <- notice the ./../ (points to same file)
> > still got the NOT working results.
> >
> > I already tried adding random jars from working project to not 
working,
> > but it didn't help.
> >
> >
> 
> I added/removed jars one by one.... of course it had to be the last one.
> When I removed
> /home/min/ucng/javaLibs/selenium-server-standalone-2.20.0.jar
> 
> It started to work. However... I need selenium - it's my main browser. 
So
> when I added it back....
> SLF4J: Class path contains multiple SLF4J bindings.
> SLF4J: Found binding in
> [jar:file:/home/min/ucng/javaLibs/pbapi-full-1.4.0.
> 
91/lib/test/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
> SLF4J: Found binding in
> [jar:file:/home/min/ucng/javaLibs/selenium-server-standalone-2.20.0.
> jar!/org/slf4j/impl/StaticLoggerBinder.class]
> SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
> explanation.
> 
> Exception in thread "main" java.lang.NoSuchMethodError:
> org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;
> Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V
> at
> org.apache.commons.logging.impl.SLF4JLocationAwareLog.
> debug(SLF4JLocationAwareLog.java:99)
> at
> org.apache.http.impl.conn.SingleClientConnManager.
> getConnection(SingleClientConnManager.java:212)
> at
> org.apache.http.impl.conn.SingleClientConnManager$1.
> getConnection(SingleClientConnManager.java:190)
> at
> org.apache.http.impl.client.DefaultRequestDirector.
> execute(DefaultRequestDirector.java:401)
> at
> org.apache.http.impl.client.AbstractHttpClient.
> execute(AbstractHttpClient.java:820)
> at
> org.apache.http.impl.client.AbstractHttpClient.
> execute(AbstractHttpClient.java:754)
> at
> org.apache.http.impl.client.AbstractHttpClient.
> execute(AbstractHttpClient.java:732)
> at jobManager.UploadManager.main2(UploadManager.java:135)
> at jobManager.UploadManager.main(UploadManager.java:44)
> Java Result: 1
> 
> And when I removed the extra slf4j
> as jar:file:/home/min/ucng/javaLibs/pbapi-full-1.4.0.
> 91/lib/test/slf4j-log4j12-1.6.1.jar
> Then I go back to a project that compiles but doesn't show output of
> HttpClient logger.
> 
> Now I am like this @_@
> What has some wierd slf4j to commons-logging or log4j. And what it has 
to
> do with HttpClient... I am so so so so confused.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message