[logback-dev] [JIRA] Commented: (LBCLASSIC-309) Groovy-config fails without outside code noticing
Endre Stølsvik (JIRA)
noreply-jira at qos.ch
Tue Apr 10 18:35:27 CEST 2012
[ http://jira.qos.ch/browse/LBCLASSIC-309?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12389#action_12389 ]
Endre Stølsvik commented on LBCLASSIC-309:
------------------------------------------
When enabling scan, a thread is started. Apparently, if there is an error in the logconfig after you've changed it, the thread dies:
Exception in thread "Thread-13" groovy.lang.MissingPropertyException: No such property: ConsoleAppender for class: Script1
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
at Script1.run(Script1.groovy:14)
at Script1$run.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at Script1$run.call(Unknown Source)
at ch.qos.logback.classic.gaffer.GafferConfigurator.run(GafferConfigurator.groovy:59)
at ch.qos.logback.classic.gaffer.GafferConfigurator$run.callCurrent(Unknown Source)
at ch.qos.logback.classic.gaffer.GafferConfigurator.run(GafferConfigurator.groovy:37)
at ch.qos.logback.classic.gaffer.GafferUtil.runGafferConfiguratorOn(GafferUtil.java:44)
at ch.qos.logback.classic.turbo.ReconfigureOnChangeFilter$ReconfiguringThread.run(ReconfigureOnChangeFilter.java:168)
The log-config still doesn't know, these are the last lines (taken from the Servlet):
2012-04-10 18:26:55 INFO ConfigurationDelegate Setting ReconfigureOnChangeFilter scanning period to 5 seconds
2012-04-10 18:26:55 INFO ReconfigureOnChangeFilter Will scan for changes in [[.../xyz.logback.groovy]] every 5 seconds.
2012-04-10 18:26:55 INFO ConfigurationDelegate Adding ReconfigureOnChangeFilter as a turbo filter
2012-04-10 18:27:24 INFO ReconfigureOnChangeFilter Detected change in [[.../xyz.logback.groovy]]
2012-04-10 18:27:24 INFO ReconfigureOnChangeFilter Will reset and reconfigure context named [Emma]
.. after this, I don't have *any* logging in my app, and there is no way to get back to having logging except of restarting the app.
> Groovy-config fails without outside code noticing
> -------------------------------------------------
>
> Key: LBCLASSIC-309
> URL: http://jira.qos.ch/browse/LBCLASSIC-309
> Project: logback-classic
> Issue Type: Bug
> Components: joran
> Affects Versions: unspecified
> Environment: na
> Reporter: Endre Stølsvik
> Assignee: Logback dev list
> Priority: Minor
>
> [As reported on the user-list, where I was requested to make a bug report]
> This groovy-file ...:
> import ch.qos.logback.classic.PatternLayout
> import ch.qos.logback.core.ConsoleAppender
> import ch.qos.logback.core.encoder.LayoutWrappingEncoder
> appender("STDOUT", ConsoleAppender) {
> encoder(LayoutWrappingEncoder) {
> layout(PatternLayout) {
> pattern = "%d{HH:mm:ss.SSS} [%thread] %-5level %logger{55}.%M.%L - %msg%n"
> }
> }
> }
> root(ALL, ["STDOUT"])
> ... apparently crashes the configuration as such:
> Failed to instantiate [ch.qos.logback.classic.LoggerContext]
> Reported exception:
> groovy.lang.MissingPropertyException: No such property: ALL for class: Script1
> at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
> at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
> at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
> at Script1.run(Script1.groovy:13)
> at Script1$run.call(Unknown Source)
> at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
> at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
> at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
> at ch.qos.logback.classic.gaffer.GafferConfigurator.run(GafferConfigurator.groovy:59)
> at ch.qos.logback.classic.gaffer.GafferConfigurator$run.callCurrent(Unknown Source)
> at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
> at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
> at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
> at ch.qos.logback.classic.gaffer.GafferConfigurator.run(GafferConfigurator.groovy:37)
> at ch.qos.logback.classic.gaffer.GafferUtil.runGafferConfiguratorOn(GafferUtil.java:44)
> at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:67)
> at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:150)
> at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:85)
> at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
> at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)
> at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108)
> at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:279)
> at XYZ.doLogConfig(XYZ.java:40)
> at XYZ.main(XYZ:169)
> The problem is obviously, as the error message states, the not-defined property "ALL".
> *The problem I am reporting is that this isn't caught*.
> The console-dump happens in the "We should never get here" catch block below:
> void init() {
> try {
> try {
> new ContextInitializer(defaultLoggerContext).autoConfig();
> } catch (JoranException je) {
> Util.report("Failed to auto configure default logger context", je);
> }
> StatusPrinter.printInCaseOfErrorsOrWarnings(defaultLoggerContext);
> contextSelectorBinder.init(defaultLoggerContext, KEY);
> initialized = true;
> } catch (Throwable t) {
> // we should never get here
> Util.report("Failed to instantiate [" + LoggerContext.class.getName()
> + "]", t);
> }
> }
> Notice that the StatusManager does not know that the config failed:
> 13:32:07,643 |-INFO in ch.qos.logback.classic.LoggerContext[Emma logcontext] - Found resource [logback.groovy] at [file:/XYZ/target/classes/logback.groovy]
> 13:32:08,807 |-INFO in ch.qos.logback.classic.gaffer.ConfigurationDelegate at 2111e072 - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
> 13:32:08,809 |-INFO in ch.qos.logback.classic.gaffer.ConfigurationDelegate at 2111e072 - Naming appender as [STDOUT]
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the logback-dev
mailing list