Skip to content

Commit

Permalink
Issue #4572 - Making sure jetty-home works with new logging modules
Browse files Browse the repository at this point in the history
Signed-off-by: Joakim Erdfelt <[email protected]>
  • Loading branch information
joakime committed Feb 21, 2020
1 parent 0ed7a3b commit 4c8f2d6
Show file tree
Hide file tree
Showing 13 changed files with 82 additions and 58 deletions.
3 changes: 1 addition & 2 deletions jetty-home/src/main/resources/modules/logging-jetty.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ lib/logging/jetty-slf4j-impl-${jetty.version}.jar

[ini]
slf4j.version?=1.8.0-beta1
jetty.webapp.addServerClasses+=,${jetty.base.uri}/lib/logging/

jetty.webapp.addSystemClasses+=,org.slf4j.,org.eclipse.jetty.logging.
5 changes: 3 additions & 2 deletions jetty-home/src/main/resources/modules/logging-jul.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ logging

[files]
basehome:modules/logging-jul
maven://org.slf4j/slf4j-jdk14/${slf4j.version}|lib/logging/slf4j-jdk14-${slf4j.version}.jar

[lib]
lib/logging/slf4j-api-${slf4j.version}.jar
maven://org.slf4j/slf4j-jdk14/${slf4j.version}|lib/logging/slf4j-jdk14-${slf4j.version}.jar
lib/logging/slf4j-jdk14-${slf4j.version}.jar

[ini]
slf4j.version?=1.8.0-beta1
java.util.logging.config.file=${jetty.base}/resources/java-util-logging.properties
jetty.webapp.addServerClasses+=,${jetty.base.uri}/lib/logging/
jetty.webapp.addSystemClasses+=,org.slf4j.

[license]
SLF4J is distributed under the MIT License.
Expand Down
9 changes: 6 additions & 3 deletions jetty-home/src/main/resources/modules/logging-log4j1.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,19 @@ logging

[files]
basehome:modules/logging-log4j1
maven://org.slf4j/slf4j-log4j12/${slf4j.version}|lib/logging/slf4j-log4j12-${slf4j.version}.jar
maven://log4j/log4j/${log4j1.version}|lib/logging/log4j-${log4j.version}.jar

[lib]
lib/logging/slf4j-api-${slf4j.version}.jar
maven://org.slf4j/slf4j-log4j12/${slf4j.version}|lib/logging/slf4j-log4j12-${slf4j.version}.jar
maven://log4j/log4j/${log4j1.version}|lib/logging/log4j-${log4j.version}.jar
lib/logging/slf4j-log4j12-${slf4j.version}.jar
lib/logging/log4j-${log4j.version}.jar

[ini]
slf4j.version?=1.8.0-beta1
log4j.version?=1.2.17
jetty.webapp.addServerClasses+=,${jetty.base.uri}/lib/logging/
jetty.webapp.addSystemClasses+=,org.slf4j.,org.apache.log4j.


[license]
SLF4J is distributed under the MIT License.
Expand Down
11 changes: 7 additions & 4 deletions jetty-home/src/main/resources/modules/logging-log4j2.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,20 @@ logging

[files]
basehome:modules/logging-log4j2

[lib]
lib/logging/slf4j-api-${slf4j.version}.jar
maven://org.apache.logging.log4j/log4j-slf4j18-impl/${log4j.version}|lib/logging/log4j-slf4j18-impl-${log4j.version}.jar
maven://org.apache.logging.log4j/log4j-api/${log4j.version}|lib/logging/log4j-api-${log4j.version}.jar
maven://org.apache.logging.log4j/log4j-core/${log4j.version}|lib/logging/log4j-core-${log4j.version}.jar

[lib]
lib/logging/slf4j-api-${slf4j.version}.jar
lib/logging/log4j-slf4j18-impl-${log4j.version}.jar
lib/logging/log4j-api-${log4j.version}.jar
lib/logging/log4j-core-${log4j.version}.jar

[ini]
slf4j.version?=1.8.0-beta1
log4j.version?=2.13.0
jetty.webapp.addServerClasses+=,${jetty.base.uri}/lib/logging/
jetty.webapp.addSystemClasses+=,org.slf4j.,org.apache.logging.log4j.

[license]
Log4j is released under the Apache 2.0 license.
Expand Down
8 changes: 5 additions & 3 deletions jetty-home/src/main/resources/modules/logging-logback.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@ logging

[files]
basehome:modules/logging-logback
maven://ch.qos.logback/logback-classic/${logback.version}|lib/logging/logback-classic-${logback.version}.jar
maven://ch.qos.logback/logback-core/${logback.version}|lib/logging/logback-core-${logback.version}.jar

[lib]
lib/logging/slf4j-api-${slf4j.version}.jar
maven://ch.qos.logback/logback-classic/${logback.version}|lib/logging/logback-classic-${logback.version}.jar
maven://ch.qos.logback/logback-core/${logback.version}|lib/logging/logback-core-${logback.version}.jar
lib/logging/logback-classic-${logback.version}.jar
lib/logging/logback-core-${logback.version}.jar

[ini]
slf4j.version?=1.8.0-beta1
logback.version?=1.3.0-alpha4
jetty.webapp.addServerClasses+=,${jetty.base.uri}/lib/logging/
jetty.webapp.addSystemClasses+=,org.slf4j.,ch.qos.logback.

[license]
Logback: the reliable, generic, fast and flexible logging framework.
Expand Down
2 changes: 1 addition & 1 deletion jetty-jmx/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>
@{argLine} ${jetty.surefire.argLine} --add-opens org.eclipse.jetty.jmx/org.eclipse.jetty.jmx=ALL-UNNAMED --add-opens org.eclipse.jetty.jmx/org.eclipse.jetty.util.log.jmx=ALL-UNNAMED
@{argLine} ${jetty.surefire.argLine} --add-opens org.eclipse.jetty.jmx/org.eclipse.jetty.jmx=ALL-UNNAMED --add-opens org.eclipse.jetty.jmx/org.eclipse.jetty.logging.jmx=ALL-UNNAMED
</argLine>
</configuration>
</plugin>
Expand Down
7 changes: 0 additions & 7 deletions jetty-jmx/src/main/config/etc/jetty-jmx.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,5 @@
</New>
</Arg>
</Call>

<!-- Add the static log -->
<Call name="addBean">
<Arg>
<Get class="org.eclipse.jetty.util.log.Log" name="Log" />
</Arg>
</Call>
</Configure>

5 changes: 5 additions & 0 deletions jetty-slf4j-impl/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@
// ========================================================================
//

import org.eclipse.jetty.logging.JettyLoggingServiceProvider;
import org.slf4j.spi.SLF4JServiceProvider;

module org.eclipse.jetty.logging
{
exports org.eclipse.jetty.logging;

requires transitive org.slf4j;

provides SLF4JServiceProvider with JettyLoggingServiceProvider;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ annotations

[lib]
lib/websocket/websocket-core-${jetty.version}.jar
lib/websocket/websocket-util-${jetty.version}.jar
lib/websocket/websocket-servlet-${jetty.version}.jar
lib/websocket/websocket-util-${jetty.version}.jar
lib/websocket/jetty-javax-websocket-api-1.1.2.jar
lib/websocket/websocket-javax-*.jar
lib/websocket/websocket-javax-client-${jetty.version}.jar
lib/websocket/websocket-javax-common-${jetty.version}.jar
lib/websocket/websocket-javax-server-${jetty.version}.jar

[jpms]
# The implementation needs to access method handles in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ annotations

[lib]
lib/websocket/websocket-core-${jetty.version}.jar
lib/websocket/websocket-util-${jetty.version}.jar
lib/websocket/websocket-servlet-${jetty.version}.jar
lib/websocket/websocket-jetty-*.jar
lib/websocket/websocket-util-${jetty.version}.jar
lib/websocket/websocket-jetty-api-${jetty.version}.jar
lib/websocket/websocket-jetty-common-${jetty.version}.jar
lib/websocket/websocket-jetty-server-${jetty.version}.jar

[jpms]
# The implementation needs to access method handles in
# classes that are in the web application classloader.
add-reads: org.eclipse.jetty.websocket.common=ALL-UNNAMED
add-reads: org.eclipse.jetty.websocket.jetty.common=ALL-UNNAMED
31 changes: 18 additions & 13 deletions tests/test-distribution/src/test/resources/test-realm.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-" "http://www.eclipse.org/jetty/configure_9_3.dtd">
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- =========================================================== -->
<!-- Configure Authentication Login Service -->
Expand All @@ -8,17 +8,22 @@
<!-- configuration (see $(jetty.home)/webapps/test.xml for an -->
<!-- example). -->
<!-- =========================================================== -->
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.security.HashLoginService">
<Set name="name">Test Realm</Set>
<Set name="config"><Property name="jetty.demo.realm" default="etc/realm.properties"/></Set>
<Set name="hotReload">false</Set>
</New>
</Arg>
</Call>
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.security.HashLoginService">
<Set name="name">Test Realm</Set>
<Set name="config">
<Property name="jetty.demo.realm" default="etc/realm.properties" />
</Set>
<Set name="hotReload">false</Set>
</New>
</Arg>
</Call>

<Get class="org.eclipse.jetty.util.log.Log" name="rootLogger">
<Call name="warn"><Arg>demo test-realm is deployed. DO NOT USE IN PRODUCTION!</Arg></Call>
</Get>
<Call class="org.slf4j.LoggerFactory" name="getLogger">
<Arg>org.eclipse.jetty</Arg>
<Call name="warn">
<Arg>demo test-realm is deployed. DO NOT USE IN PRODUCTION!</Arg>
</Call>
</Call>
</Configure>
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,22 @@
<!-- configuration (see $(jetty.home)/webapps/test.xml for an -->
<!-- example). -->
<!-- =========================================================== -->
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.security.HashLoginService">
<Set name="name">Test Realm</Set>
<Set name="config"><Property name="jetty.demo.realm" default="etc/realm.properties"/></Set>
<Set name="hotReload">false</Set>
</New>
</Arg>
</Call>
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.security.HashLoginService">
<Set name="name">Test Realm</Set>
<Set name="config">
<Property name="jetty.demo.realm" default="etc/realm.properties" />
</Set>
<Set name="hotReload">false</Set>
</New>
</Arg>
</Call>

<Get class="org.eclipse.jetty.util.log.Log" name="rootLogger">
<Call name="warn"><Arg>demo test-realm is deployed. DO NOT USE IN PRODUCTION!</Arg></Call>
</Get>
<Call class="org.slf4j.LoggerFactory" name="getLogger">
<Arg>org.eclipse.jetty</Arg>
<Call name="warn">
<Arg>demo test-realm is deployed. DO NOT USE IN PRODUCTION!</Arg>
</Call>
</Call>
</Configure>
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@

<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Get name="servletContext">
<Call name="log"><Arg>The test-spec webapp is deployed. DO NOT USE IN PRODUCTION!</Arg><Arg></Arg></Call>
<Call name="log">
<Arg>The test-spec webapp is deployed. DO NOT USE IN PRODUCTION!</Arg>
<Arg></Arg>
</Call>
</Get>
<!--TODO uncomment once 9.4.19 is released with a fix for #3726
<Get class="org.eclipse.jetty.util.log.Log" name="rootLogger">
<Call name="info"><Arg>WEB-INF/lib/jetty-util.jar logging used!</Arg></Call>
</Get>
-->
<Call class="org.slf4j.LoggerFactory" name="getLogger">
<Arg>org.eclipse.jetty</Arg>
<Call name="info">
<Arg>WEB-INF/lib/jetty-util.jar logging used!</Arg>
</Call>
</Call>
</Configure>

0 comments on commit 4c8f2d6

Please sign in to comment.