mguymon / lock_jar

LockJar manages Java Jars for Ruby

Home Page:http://mguymon.github.io/lock_jar/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chatty startup with multiple logback.xml

ramarnat opened this issue · comments

I just switched from using require 'some.jar' to using lock_jar, but I am now seeing this chatty output because of multiple logback.xml on the class path

15:12:20,966 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
15:12:20,966 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
15:12:20,966 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [jar:file:/Users/ramarnat/.rbenv/versions/jruby-1.7.4/lib/ruby/gems/shared/gems/naether-0.10.1-java/core-0.10.1.jar!/logback.xml]
15:12:20,967 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs multiple times on the classpath.
15:12:20,967 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [jar:file:/Users/ramarnat/.rbenv/versions/jruby-1.7.4/lib/ruby/gems/shared/gems/naether-0.10.1-java/core-0.10.1.jar!/logback.xml]
15:12:20,967 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [jar:file:/Users/ramarnat/.m2/repository/org/drools/drools-examples/5.5.0.Final/drools-examples-5.5.0.Final.jar!/logback.xml]
15:12:20,967 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [jar:file:/Users/ramarnat/.m2/repository/org/drools/drools-examples/5.5.0.Final/drools-examples-5.5.0.Final-sources.jar!/logback.x

Is there a way to exclude these from getting loaded?

Must be due to Naether's logging. Odd that the log level for Logback would be at INFO. Either that can be set to ERROR or ignore Logbacks output on start up by default.

based on what I am seeing elsewhere, it seems that this chattiness shows on the console only if a warning or error shows up during the logback spinup

Yeah, looks like the logging just needs tweaked in the logback config. Right now the log level is INFO for everything - https://github.com/mguymon/naether/blob/master/src/main/resources/logback.xml

I updated the logging on Naether and updated LockJar to use the latest Naether. Can you test on the master branch to see if it solves the chatty logging?

Bah, network error when loading a Jar caused Travis to fail

np, keep me posted and I'll test

looks like the issue is still there

20:53:55,610 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
20:53:55,610 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
20:53:55,610 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [jar:file:/Users/ramarnat/.rbenv/versions/jruby-1.7.4/lib/ruby/gems/shared/gems/naether-0.13.1-java/core-0.13.1.jar!/logback.xml]
20:53:55,611 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs multiple times on the classpath.
20:53:55,611 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [jar:file:/Users/ramarnat/.rbenv/versions/jruby-1.7.4/lib/ruby/gems/shared/gems/naether-0.13.1-java/core-0.13.1.jar!/logback.xml]
20:53:55,611 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [jar:file:/Users/ramarnat/.m2/repository/org/drools/drools-examples/5.5.0.Final/drools-examples-5.5.0.Final.jar!/logback.xml]
20:53:55,611 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [jar:file:/Users/ramarnat/.m2/repository/org/drools/drools-examples/5.5.0.Final/drools-examples-5.5.0.Final-sources.jar!/logback.xml]
20:53:55,634 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@7b429b9f - URL [jar:file:/Users/ramarnat/.rbenv/versions/jruby-1.7.4/lib/ruby/gems/shared/gems/naether-0.13.1-java/core-0.13.1.jar!/logback.xml] is not of type file
20:53:55,651 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
20:53:55,651 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
20:53:55,654 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
20:53:55,688 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.tobedevoured] to INFO
20:53:55,688 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to ERROR
20:53:55,688 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
20:53:55,689 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@51f722f1 - Registering current configuration as safe fallback point

0.13.2 has this error now

21:47:07,815 |-ERROR in ch.qos.logback.core.joran.action.StatusListenerAction - Could not create an StatusListener of type [ch.qos.logback.core.status.NopStatusListener]. ch.qos.logback.core.util.DynamicClassLoadingException: Failed to instantiate type ch.qos.logback.core.status.NopStatusListener

Yeah, it doesn't exist on the logback version Naether uses (1.0.6). It its only 3 lines of java, I am just going to backport it and push out a new gem.

Added the NOPStatusListener that should mute Logbacks complaints. Can you update your Naether version to 0.13.2 and see if that fixes it?

:(

22:11:58,801 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
22:11:58,801 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
22:11:58,801 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [jar:file:/Users/ramarnat/.rbenv/versions/jruby-1.7.4/lib/ruby/gems/shared/gems/naether-0.13.3-java/core-0.13.3.jar!/logback.xml]
22:11:58,803 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs multiple times on the classpath.
22:11:58,803 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [jar:file:/Users/ramarnat/.rbenv/versions/jruby-1.7.4/lib/ruby/gems/shared/gems/naether-0.13.3-java/core-0.13.3.jar!/logback.xml]
22:11:58,803 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [jar:file:/Users/ramarnat/.m2/repository/org/drools/drools-examples/5.5.0.Final/drools-examples-5.5.0.Final.jar!/logback.xml]
22:11:58,803 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [jar:file:/Users/ramarnat/.m2/repository/org/drools/drools-examples/5.5.0.Final/drools-examples-5.5.0.Final-sources.jar!/logback.xml]
22:11:58,819 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@74c3b0c9 - URL [jar:file:/Users/ramarnat/.rbenv/versions/jruby-1.7.4/lib/ruby/gems/shared/gems/naether-0.13.3-java/core-0.13.3.jar!/logback.xml] is not of type file
22:11:58,841 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
22:11:58,842 |-INFO in ch.qos.logback.core.joran.action.StatusListenerAction - Adding status listener of type [ch.qos.logback.core.status.NopStatusListener]
22:11:58,842 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
22:11:58,845 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
22:11:58,881 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.tobedevoured] to INFO
22:11:58,881 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to ERROR
22:11:58,881 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
22:11:58,883 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@5b8b9802 - Registering current configuration as safe fallback point

My my, looks like I was able to increase the size of the output.

let me sanitize the repo and upload to github, so you can take a deeper look - maybe its something in the other lib.

The root cause is multiple logback.xml in the classpath. Naether ships with one. Looks like it is tripping up with 2 other jars on the classpath, drools-examples-5.5.0.Final.jar and drools-examples-5.5.0.Final-sources.jar.

When logback starts up, if it has a warning, it will output its entire status output. It is possible upgrading to Logback 1.1 combined with the NopStatusListener might fix it, but I am not sure. Maybe the best route is to just drop logback for vanilla java logging.

Yeah, looks like using jcl vanilla java logging instead not a big change. Lets try that. . .

ok. I also streamlined the jars I am loading for drools. will see how it does with JCL. on the east coast, so probably wont see it till tomm.

No worries, when you get a chance update Naether to 0.13.4 and see if the finally silences the spam.

Yay. eliminated the logback messages, but has these three lines left, maybe some cleanup needed from 13.2?

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

Looks like it needs SLF4J simple logger since logback was removed.

ok, let me know when you have the next version of naether up

is that something I can just add as a dependency in the Jarfile?

No because Naether loads itself into its own classloader. It just needs to add log4j-simple, but I have not had time to update the Gem.

no worries.

I sent a pull request that I believe will setup the Naether classloader with the right jar for simple logging

I updated the naether with your pull request and released gem to 0.13.6

I merged your pull and pushed out Naether gem 0.13.7. Give it a whirl!

forgot to close this out....

works like a charm.