Skip to content

Commit

Permalink
Jetty 11: Disable log configuration via Gaffer for now and add FIXMEs
Browse files Browse the repository at this point in the history
  • Loading branch information
f4lco committed Nov 13, 2020
1 parent e92596e commit 980affb
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import org.codehaus.groovy.control.CompilerConfiguration
*
* @author akhikhl
*/
// FIXME #162 recent logback versions do not include GafferConfigurator
// see also: remark in Runner.groovy, the only call site
@CompileStatic(TypeCheckingMode.SKIP)
class GafferConfiguratorEx extends GafferConfigurator {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,17 @@ final class Runner {
binding.logFileName = serverParams.logFileName
binding.logDir = serverParams.logDir
binding.grettyDebug = params.debug
new GafferConfiguratorEx(logCtx).run(binding, logbackConfigText)
// FIXME #162 logback has temporarily suspended GafferConfigurator.
// We do not know if and when it will come back, see news of 2019-10-11:
// http://logback.qos.ch/news.html
// new GafferConfiguratorEx(logCtx).run(binding, logbackConfigText)
// Instead we use a fixed configuration file, which does not respect all the different
// logging toggles in Gretty:
Runner.class.getResource('/grettyRunnerLogback.xml').withInputStream {
JoranConfigurator configurator = new JoranConfigurator();
configurator.setContext(logCtx)
configurator.doConfigure(it)
}
}

private static Level stringToLoggingLevel(String str) {
Expand Down
32 changes: 32 additions & 0 deletions libs/gretty-runner/src/main/resources/grettyRunnerLogback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!--
FIXME #162
This is a cheap replacement for the Gaffer configuration.
It should never ship.
Either Logback integrates the Gaffer configuration again,
or we find another solution to programmatic configuration
of Logback.
-->
<configuration>

<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>

<logger name="org.apache.catalina" level="WARN" />
<logger name="org.apache.coyote" level="WARN" />
<logger name="org.apache.jasper" level="WARN" />
<logger name="org.apache.tomcat" level="WARN" />
<logger name="org.eclipse.jetty" level="WARN" />

<logger name="org.eclipse.jetty.annotations.AnnotationConfiguration" level="ERROR" />
<logger name="org.eclipse.jetty.annotations.AnnotationParser" level="ERROR" />
<logger name="org.eclipse.jetty.util.component.AbstractLifeCycle" level="ERROR" />

<logger name="org.akhikhl.gretty" level="DEBUG" />

<root level="debug">
<appender-ref ref="STDOUT" />
</root>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ class ServletContainerConfig {
def asm_version = project.ext.asmVersion
force "org.ow2.asm:asm:$asm_version"
force "org.ow2.asm:asm-commons:$asm_version"

// FIXME #162 make Tomcat and Jetty agree on a common version of logback again?
force 'ch.qos.logback:logback-classic:1.3.0-alpha5'
force 'org.slf4j:slf4j-api:2.0.0-alpha1'
}
},
servletApiVersion: { project -> project.ext.jetty11ServletApiVersion },
Expand Down

0 comments on commit 980affb

Please sign in to comment.