Issue #4572 - Replace Jetty Logging with SLF4J

* Introducing jetty-slf4j-impl
* Make Jetty use org.slf4j
* Removed most of org.eclipse.jetty.util.log classes
* Left org.eclipse.jetty.util.log.Log and
       org.eclipse.jetty.util.log.Logger but as
  simple bridge classes that are deprecated
* Migrated code using org.eclipse.jetty.util.log.StacklessLogging
  to org.eclipse.jetty.logging.StacklessLogging found in
  the jetty-slf4j-impl
* Moved logging start modules from jetty-util to jetty-home
* Simplified logging start modules
* Updated code that was using StdErrLog directly
* Updating module-info.java for org.slf4j
* removing org.eclipse.jetty.util.log.class references
* jetty-start supports manually declared default provider
  + and we use it to default "logging" to the "logging-jetty" provider
* Cleaning up jetty-maven-plugin and IT testing for Logging
* Using old slf4j for it testing
* Updating compiler config to show Xlint:exports warnings
* Updating console-capture and logging-noop
* Adding slf4j bridge (capture) jetty modules
* Updates to jetty logging module locations
* Changing reference to slf4j dependent mod
* Process requested enabled modules in topological order
* Limiting inclusions in shaded jetty-start
  + Also adding note to jetty-util classes that are used by
    jetty-start
* Default logging level on baseline logging config is INFO (not DEBUG)
* Changing from system to server classes in logging
* Updating other modules to use new logging names

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Joakim Erdfelt 2020-02-24 13:20:51 -06:00
parent 5148bee8f2
commit 8b7e64915f
No known key found for this signature in database
GPG Key ID: 2D0E1FB8FE4B68B4
319 changed files with 4419 additions and 5511 deletions

View File

@ -63,6 +63,10 @@
</build>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>

View File

@ -29,6 +29,7 @@ module org.eclipse.jetty.apache.jsp
requires java.xml;
requires jetty.servlet.api;
requires org.slf4j;
requires org.eclipse.jetty.util;
requires org.mortbay.apache.jasper;

View File

@ -18,6 +18,8 @@
package org.eclipse.jetty.apache.jsp;
import org.slf4j.LoggerFactory;
public class JuliLog implements org.apache.juli.logging.Log
{
public static org.apache.juli.logging.Log getInstance(String name)
@ -25,19 +27,16 @@ public class JuliLog implements org.apache.juli.logging.Log
return new JuliLog(name);
}
private final org.eclipse.jetty.util.log.Logger _logger;
private final org.eclipse.jetty.util.log.StdErrLog _stdErrLog;
private final org.slf4j.Logger _logger;
public JuliLog()
{
_logger = org.eclipse.jetty.util.log.Log.getRootLogger();
_stdErrLog = (_logger instanceof org.eclipse.jetty.util.log.StdErrLog) ? (org.eclipse.jetty.util.log.StdErrLog)_logger : null;
_logger = LoggerFactory.getLogger("");
}
public JuliLog(String name)
{
_logger = org.eclipse.jetty.util.log.Log.getLogger(name);
_stdErrLog = (_logger instanceof org.eclipse.jetty.util.log.StdErrLog) ? (org.eclipse.jetty.util.log.StdErrLog)_logger : null;
_logger = LoggerFactory.getLogger(name);
}
@Override
@ -49,31 +48,31 @@ public class JuliLog implements org.apache.juli.logging.Log
@Override
public boolean isErrorEnabled()
{
return _stdErrLog == null ? true : _stdErrLog.getLevel() <= org.eclipse.jetty.util.log.StdErrLog.LEVEL_WARN;
return _logger.isErrorEnabled();
}
@Override
public boolean isFatalEnabled()
{
return _stdErrLog == null ? true : _stdErrLog.getLevel() <= org.eclipse.jetty.util.log.StdErrLog.LEVEL_WARN;
return _logger.isErrorEnabled();
}
@Override
public boolean isInfoEnabled()
{
return _stdErrLog == null ? true : _stdErrLog.getLevel() <= org.eclipse.jetty.util.log.StdErrLog.LEVEL_INFO;
return _logger.isInfoEnabled();
}
@Override
public boolean isTraceEnabled()
{
return _stdErrLog == null ? true : _stdErrLog.getLevel() <= org.eclipse.jetty.util.log.StdErrLog.LEVEL_DEBUG;
return _logger.isTraceEnabled();
}
@Override
public boolean isWarnEnabled()
{
return _stdErrLog == null ? true : _stdErrLog.getLevel() <= org.eclipse.jetty.util.log.StdErrLog.LEVEL_WARN;
return _logger.isWarnEnabled();
}
@Override

View File

@ -1,3 +1,3 @@
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
# Jetty Logging using jetty-slf4j-impl
# org.eclipse.jetty.LEVEL=INFO
# org.eclipse.jetty.util.LEVEL=DEBUG

View File

@ -15,6 +15,14 @@
<bundle-symbolic-name>${project.groupId}.embedded</bundle-symbolic-name>
</properties>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-slf4j-impl</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util-ajax</artifactId>

View File

@ -1,4 +1,4 @@
#org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.JavaUtilLog
## Jetty Logging using jetty-slf4j-impl
#org.eclipse.jetty.util.log.javautil.PROPERTIES=java-util-logging.properties
#org.eclipse.jetty.util.log.SOURCE=true
#org.eclipse.jetty.LEVEL=INFO

View File

@ -1,4 +1,4 @@
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
# Jetty Logging using jetty-slf4j-impl
org.eclipse.jetty.LEVEL=INFO
org.eclipse.jetty.embedded.JettyDistribution.LEVEL=DEBUG
#org.eclipse.jetty.STACKS=true

View File

@ -23,6 +23,7 @@ module org.eclipse.jetty.alpn.client
exports org.eclipse.jetty.alpn.client;
requires transitive org.eclipse.jetty.io;
requires org.slf4j;
uses ALPNProcessor.Client;
}

View File

@ -23,6 +23,7 @@ module org.eclipse.jetty.alpn.conscrypt.client
{
requires org.conscrypt;
requires transitive org.eclipse.jetty.alpn.client;
requires org.slf4j;
provides ALPNProcessor.Client with ConscryptClientALPNProcessor;
}

View File

@ -1,2 +1,2 @@
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
# Jetty Logging using jetty-slf4j-impl
#org.eclipse.jetty.LEVEL=DEBUG

View File

@ -22,6 +22,7 @@ import org.eclipse.jetty.io.ssl.ALPNProcessor;
module org.eclipse.jetty.alpn.conscrypt.server
{
requires org.conscrypt;
requires org.slf4j;
requires transitive org.eclipse.jetty.alpn.server;
provides ALPNProcessor.Server with ConscryptServerALPNProcessor;

View File

@ -1,3 +1,3 @@
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
# Jetty Logging using jetty-slf4j-impl
#org.eclipse.jetty.LEVEL=DEBUG
#org.eclipse.jetty.alpn.LEVEL=DEBUG

View File

@ -22,6 +22,7 @@ import org.eclipse.jetty.io.ssl.ALPNProcessor;
module org.eclipse.jetty.alpn.java.client
{
requires transitive org.eclipse.jetty.alpn.client;
requires org.slf4j;
provides ALPNProcessor.Client with JDK9ClientALPNProcessor;
}

View File

@ -1,2 +1,2 @@
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
# Jetty Logging using jetty-slf4j-impl
#org.eclipse.jetty.LEVEL=DEBUG

View File

@ -21,6 +21,7 @@ import org.eclipse.jetty.io.ssl.ALPNProcessor;
module org.eclipse.jetty.alpn.java.server
{
requires org.slf4j;
requires transitive org.eclipse.jetty.alpn.server;
provides ALPNProcessor.Server with JDK9ServerALPNProcessor;

View File

@ -1,3 +1,3 @@
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
# Jetty Logging using jetty-slf4j-impl
#org.eclipse.jetty.LEVEL=DEBUG
#org.eclipse.jetty.alpn.LEVEL=DEBUG

View File

@ -23,6 +23,7 @@ module org.eclipse.jetty.alpn.server
exports org.eclipse.jetty.alpn.server;
requires transitive org.eclipse.jetty.server;
requires org.slf4j;
uses ALPNProcessor.Server;
}

View File

@ -29,6 +29,7 @@ module org.eclipse.jetty.annotations
requires java.naming;
requires transitive org.eclipse.jetty.plus;
requires transitive org.objectweb.asm;
requires org.slf4j;
uses ServletContainerInitializer;

View File

@ -20,10 +20,10 @@ package org.eclipse.jetty.annotations;
import java.io.File;
import org.eclipse.jetty.logging.StacklessLogging;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.servlet.Source;
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.eclipse.jetty.util.log.StacklessLogging;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.webapp.FragmentDescriptor;
import org.eclipse.jetty.webapp.WebAppContext;

View File

@ -1,3 +1,3 @@
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
# Jetty Logging using jetty-slf4j-impl
#org.eclipse.jetty.LEVEL=DEBUG
#org.eclipse.jetty.annotations.LEVEL=DEBUG

View File

@ -24,7 +24,6 @@
@{argLine} ${jetty.surefire.argLine}
--add-modules java.security.jgss
--add-modules org.eclipse.jetty.jmx
--add-modules org.slf4j
</argLine>
</configuration>
</plugin>
@ -157,11 +156,10 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-slf4j-impl</artifactId>
<scope>test</scope>
</dependency>
<dependency>

View File

@ -28,6 +28,7 @@ module org.eclipse.jetty.client
requires org.eclipse.jetty.alpn.client;
requires transitive org.eclipse.jetty.http;
requires org.slf4j;
// Only required if using SPNEGO.
requires static java.security.jgss;

View File

@ -82,6 +82,7 @@ import org.eclipse.jetty.http.HttpVersion;
import org.eclipse.jetty.io.AbstractConnection;
import org.eclipse.jetty.io.ClientConnector;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.logging.StacklessLogging;
import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.toolchain.test.Net;
import org.eclipse.jetty.toolchain.test.jupiter.WorkDir;
@ -92,7 +93,6 @@ import org.eclipse.jetty.util.FuturePromise;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.Promise;
import org.eclipse.jetty.util.SocketAddressResolver;
import org.eclipse.jetty.util.log.StacklessLogging;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.condition.DisabledIfSystemProperty;

View File

@ -35,9 +35,9 @@ import org.eclipse.jetty.client.api.Result;
import org.eclipse.jetty.client.util.ByteBufferContentProvider;
import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.http.HttpVersion;
import org.eclipse.jetty.logging.StacklessLogging;
import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.StacklessLogging;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
import org.junit.jupiter.params.ParameterizedTest;

View File

@ -33,9 +33,9 @@ import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.client.api.Request;
import org.eclipse.jetty.client.api.Result;
import org.eclipse.jetty.client.util.ByteBufferContentProvider;
import org.eclipse.jetty.logging.StacklessLogging;
import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.log.StacklessLogging;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ArgumentsSource;

View File

@ -1,4 +1,4 @@
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
# Jetty Logging using jetty-slf4j-impl
#org.eclipse.jetty.LEVEL=DEBUG
#org.eclipse.jetty.client.LEVEL=DEBUG
#org.eclipse.jetty.io.ChannelEndPoint.LEVEL=DEBUG

View File

@ -51,6 +51,10 @@
<version>${project.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>

View File

@ -27,6 +27,7 @@ module org.eclipse.jetty.deploy
requires java.xml;
requires transitive org.eclipse.jetty.webapp;
requires org.eclipse.jetty.xml;
requires org.slf4j;
// Only required if using JMX.
requires static org.eclipse.jetty.jmx;

View File

@ -24,6 +24,7 @@ import java.nio.file.Path;
import javax.servlet.ServletException;
import org.eclipse.jetty.deploy.providers.WebAppProvider;
import org.eclipse.jetty.logging.StacklessLogging;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
@ -33,12 +34,11 @@ import org.eclipse.jetty.toolchain.test.FS;
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.eclipse.jetty.toolchain.test.jupiter.WorkDir;
import org.eclipse.jetty.toolchain.test.jupiter.WorkDirExtension;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.StacklessLogging;
import org.eclipse.jetty.webapp.WebAppContext;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.slf4j.LoggerFactory;
import static java.time.Duration.ofSeconds;
import static org.hamcrest.MatcherAssert.assertThat;
@ -103,10 +103,9 @@ public class BadAppDeployTest
assertTimeoutPreemptively(ofSeconds(10), () ->
{
try (StacklessLogging ignore = new StacklessLogging(Log.getLogger(WebAppContext.class),
Log.getLogger(DeploymentManager.class),
Log.getLogger("org.eclipse.jetty.server.handler.ContextHandler.badapp")))
try (StacklessLogging ignore = new StacklessLogging(LoggerFactory.getLogger(WebAppContext.class),
LoggerFactory.getLogger(DeploymentManager.class),
LoggerFactory.getLogger("org.eclipse.jetty.server.handler.ContextHandler.badapp")))
{
ServletException cause = assertThrows(ServletException.class, () -> server.start());
assertThat(cause.getMessage(), containsString("intentionally"));
@ -157,9 +156,9 @@ public class BadAppDeployTest
assertTimeoutPreemptively(ofSeconds(10), () ->
{
try (StacklessLogging ignore = new StacklessLogging(Log.getLogger(WebAppContext.class),
Log.getLogger(DeploymentManager.class),
Log.getLogger("org.eclipse.jetty.server.handler.ContextHandler.badapp")))
try (StacklessLogging ignore = new StacklessLogging(LoggerFactory.getLogger(WebAppContext.class),
LoggerFactory.getLogger(DeploymentManager.class),
LoggerFactory.getLogger("org.eclipse.jetty.server.handler.ContextHandler.badapp")))
{
ServletException cause = assertThrows(ServletException.class, () -> server.start());
assertThat(cause.getMessage(), containsString("intentionally"));

View File

@ -1,4 +1,4 @@
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
# Jetty Logging using jetty-slf4j-impl
org.eclipse.jetty.deploy.LEVEL=WARN
org.eclipse.jetty.util.Scanner=WARN
#org.eclipse.jetty.webapp.LEVEL=DEBUG

View File

@ -24,4 +24,5 @@ module org.eclipse.jetty.fcgi.client
exports org.eclipse.jetty.fcgi.parser;
requires transitive org.eclipse.jetty.client;
requires org.slf4j;
}

View File

@ -1,3 +1,3 @@
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
# Jetty Logging using jetty-slf4j-impl
#org.eclipse.jetty.client.LEVEL=DEBUG
#org.eclipse.jetty.fcgi.LEVEL=DEBUG

View File

@ -15,6 +15,10 @@
</properties>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-servlet-api</artifactId>

View File

@ -21,6 +21,7 @@ module org.eclipse.jetty.fcgi.server
exports org.eclipse.jetty.fcgi.server;
exports org.eclipse.jetty.fcgi.server.proxy;
requires org.slf4j;
requires transitive org.eclipse.jetty.fcgi.client;
requires transitive org.eclipse.jetty.proxy;

View File

@ -260,7 +260,7 @@ public class FastCGIProxyServlet extends AsyncProxyServlet.Transparent
fcgi.put(field.getName(), field.getValue());
}
String eol = System.lineSeparator();
_log.debug("FastCGI variables{}{}", eol, fcgi.entrySet().stream()
_log.debug("FastCGI variables {}{}", eol, fcgi.entrySet().stream()
.map(entry -> String.format("%s: %s", entry.getKey(), entry.getValue()))
.collect(Collectors.joining(eol)));
}

View File

@ -45,11 +45,11 @@ import org.eclipse.jetty.client.util.DeferredContentProvider;
import org.eclipse.jetty.client.util.FutureResponseListener;
import org.eclipse.jetty.http.HttpMethod;
import org.eclipse.jetty.io.MappedByteBufferPool;
import org.eclipse.jetty.logging.StacklessLogging;
import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.toolchain.test.IO;
import org.eclipse.jetty.toolchain.test.Net;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.log.StacklessLogging;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIfSystemProperty;

View File

@ -1,3 +1,3 @@
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
# Jetty Logging using jetty-slf4j-impl
#org.eclipse.jetty.client.LEVEL=DEBUG
#org.eclipse.jetty.fcgi.LEVEL=DEBUG

View File

@ -9,6 +9,6 @@ gcloud
[depends]
gcloud
jcl-slf4j
jul-impl
logging-jcl-capture
logging-jul

View File

@ -170,6 +170,33 @@
<outputDirectory>${source-assembly-directory}/lib</outputDirectory>
</configuration>
</execution>
<execution>
<id>copy-lib-logging-deps</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeGroupIds>org.eclipse.jetty,org.slf4j</includeGroupIds>
<includeArtifactIds>jetty-slf4j-impl,slf4j-api</includeArtifactIds>
<includeTypes>jar</includeTypes>
<outputDirectory>${assembly-directory}/lib/logging</outputDirectory>
</configuration>
</execution>
<execution>
<id>copy-lib-logging-src-deps</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeGroupIds>org.eclipse.jetty,org.slf4j</includeGroupIds>
<includeArtifactIds>jetty-slf4j-impl,slf4j-api</includeArtifactIds>
<includeTypes>jar</includeTypes>
<classifier>sources</classifier>
<outputDirectory>${source-assembly-directory}/lib/logging</outputDirectory>
</configuration>
</execution>
<execution>
<id>copy-lib-websocket-deps</id>
<phase>generate-resources</phase>
@ -603,6 +630,11 @@
</dependency>
<!-- jetty deps -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-slf4j-impl</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-deploy</artifactId>

View File

@ -0,0 +1,5 @@
<?xml version="1.0"?><!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">
<Configure id="logging-jul-capture">
<Call class="org.slf4j.bridge.SLF4JBridgeHandler" name="install" />
</Configure>

View File

@ -1,23 +1,23 @@
DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
Provides SLF4J API. Requires a slf4j implementation (eg slf4j-simple-impl)
otherwise a noop implementation is used.
Capture jakarta-commons-logging events and bridge them to org.slf4j
[tags]
logging
slf4j
internal
[depends]
logging/slf4j
logging
[provides]
commons-logging
[files]
maven://org.slf4j/slf4j-api/${slf4j.version}|lib/slf4j/slf4j-api-${slf4j.version}.jar
maven://org.slf4j/jcl-over-slf4j/%{slf4j.version}|jcl-over-slf4j-${slf4j.version}.jar
[lib]
lib/slf4j/slf4j-api-${slf4j.version}.jar
[ini]
slf4j.version?=1.8.0-beta2
jetty.webapp.addServerClasses+=,${jetty.base.uri}/lib/slf4j/
lib/logging/jcl-over-slf4j-${slf4j.version}.jar
[license]
SLF4J is distributed under the MIT License.
@ -42,3 +42,5 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,24 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
Configure jetty logging mechanism.
Provides a ${jetty.base}/resources/jetty-logging.properties.
[tags]
logging
[depends]
logging/slf4j
resources
[provides]
logging|default
[files]
basehome:modules/logging/jetty
[lib]
lib/logging/jetty-slf4j-impl-${jetty.version}.jar
[ini]
jetty.webapp.addServerClasses+=,org.eclipse.jetty.logging.

View File

@ -0,0 +1,47 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
Capture java.util.logging events and bridge them to org.slf4j
[tags]
logging
[depends]
logging/slf4j
logging
[provides]
java-util-logging
[xml]
etc/logging-jul-capture.xml
[files]
maven://org.slf4j/jul-to-slf4j/%{slf4j.version}|jul-to-slf4j-${slf4j.version}.jar
[lib]
lib/logging/jul-to-slf4j-${slf4j.version}.jar
[license]
SLF4J is distributed under the MIT License.
Copyright (c) 2004-2013 QOS.ch
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,53 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
Configure jetty logging to use Java Util Logging (jul)
SLF4J is used as the core logging mechanism.
[tags]
logging
[depends]
logging/slf4j
resources
[provides]
logging
java-util-logging
[files]
basehome:modules/logging/jul
maven://org.slf4j/slf4j-jdk14/${slf4j.version}|lib/logging/slf4j-jdk14-${slf4j.version}.jar
[lib]
lib/logging/slf4j-jdk14-${slf4j.version}.jar
[ini]
slf4j.version?=2.0.0-alpha1
java.util.logging.config.file=${jetty.base}/resources/java-util-logging.properties
[license]
SLF4J is distributed under the MIT License.
Copyright (c) 2004-2013 QOS.ch
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,44 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
Capture Apache log4j events and bridge them to org.slf4j
[tags]
logging
[depends]
logging/slf4j
logging
[provides]
log4j
[files]
maven://org.slf4j/jcl-over-slf4j/%{slf4j.version}|jcl-over-slf4j-${slf4j.version}.jar
[lib]
lib/logging/log4j-to-slf4j-${slf4j.version}.jar
[license]
SLF4J is distributed under the MIT License.
Copyright (c) 2004-2013 QOS.ch
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,58 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
Configure jetty logging to use Log4j Logging
SLF4J is used as the core logging mechanism.
[tags]
logging
[depends]
logging/slf4j
resources
[provides]
logging
log4j
[files]
basehome:modules/logging/log4j1
maven://log4j/log4j/${log4j.version}|lib/logging/log4j-${log4j.version}.jar
maven://org.slf4j/slf4j-log4j12/${slf4j.version}|lib/logging/slf4j-log4j12-${slf4j.version}.jar
[lib]
lib/logging/slf4j-log4j12-${slf4j.version}.jar
lib/logging/log4j-${log4j.version}.jar
[ini]
log4j.version?=1.2.17
jetty.webapp.addServerClasses+=,org.apache.log4j.
[license]
Log4j is released under the Apache 2.0 license.
http://www.apache.org/licenses/LICENSE-2.0.html
SLF4J is distributed under the MIT License.
Copyright (c) 2004-2013 QOS.ch
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,35 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
Configure jetty logging to use log4j version 2
SLF4J is used as the core logging mechanism.
[tags]
logging
[depends]
logging/slf4j
resources
[provides]
logging
log4j
[files]
basehome:modules/logging/log4j2
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/log4j-slf4j18-impl-${log4j.version}.jar
lib/logging/log4j-api-${log4j.version}.jar
lib/logging/log4j-core-${log4j.version}.jar
[ini]
log4j.version?=2.13.0
jetty.webapp.addServerClasses+=,org.apache.logging.log4j.
[license]
Log4j is released under the Apache 2.0 license.
http://www.apache.org/licenses/LICENSE-2.0.html

View File

@ -0,0 +1,45 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
Configure jetty logging to use Logback Logging.
SLF4J is used as the core logging mechanism.
[tags]
logging
[depends]
logging/slf4j
resources
[provides]
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/logback-classic-${logback.version}.jar
lib/logging/logback-core-${logback.version}.jar
[ini]
logback.version?=1.3.0-alpha5
jetty.webapp.addServerClasses+=,ch.qos.logback.
[license]
Logback: the reliable, generic, fast and flexible logging framework.
Copyright (C) 1999-2012, QOS.ch. All rights reserved.
This program and the accompanying materials are dual-licensed under
either:
the terms of the Eclipse Public License v1.0
as published by the Eclipse Foundation:
http://www.eclipse.org/legal/epl-v10.html
or (per the licensee's choosing) under
the terms of the GNU Lesser General Public License version 2.1
as published by the Free Software Foundation:
http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html

View File

@ -0,0 +1,13 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
Configure logging to use SLF4J No-Op Implementation
[tags]
logging
[provides]
logging
[depends]
logging/slf4j

View File

@ -0,0 +1,8 @@
## Set logging levels from: ALL, TRACE, DEBUG, INFO, WARN, ERROR, OFF
org.eclipse.jetty.LEVEL=INFO
## Configure a level for an arbitrary logger tree
#com.example.LEVEL=INFO
## Configure a level for specific logger
#com.example.MyComponent.LEVEL=INFO
## Hide stacks traces in an arbitrary logger tree
#com.example.STACKS=false

View File

@ -0,0 +1,13 @@
.level=INFO
handlers=java.util.logging.ConsoleHandler
java.util.logging.ConsoleHandler.level=INFO
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
## Note: The java.util.logging.SimpleFormatter does NOT have the ability to display
## the Thread name of when the logging event occurred, this will make debugging difficult
## See https://stackoverflow.com/questions/6889057/printing-thread-name-using-java-util-logging
java.util.logging.SimpleFormatter.format=%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS [%4$s] (%3$s) - %5$s%6$s%n
#handlers = java.util.logging.FileHandler
#java.util.logging.FileHandler.pattern = ${jetty.logging.dir}/jetty%u.log
#java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration debug="false" xmlns:log4j='http://jakarta.apache.org/log4j/'>
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} [%p] :%t: (%c) - %m%n" />
</layout>
</appender>
<root>
<level value="INFO" />
<appender-ref ref="console" />
</root>
</log4j:configuration>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Appenders>
<Console name="LogToConsole" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%level] :%t: (%logger) - %msg%n" />
</Console>
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="LogToConsole" />
</Root>
</Loggers>
</Configuration>

View File

@ -0,0 +1,11 @@
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%level] :%thread: \(%logger\) - %msg%n</pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="STDOUT" />
</root>
</configuration>

View File

@ -0,0 +1,18 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
Configure logging to use slf4j with no impl
(If you don't select an impl, then NOP will be used by slf4j)
[tags]
logging
[provides]
slf4j
[lib]
lib/logging/slf4j-api-${slf4j.version}.jar
[ini]
slf4j.version?=2.0.0-alpha1
jetty.webapp.addServerClasses+=,org.slf4j.

View File

@ -25,6 +25,7 @@ module org.eclipse.jetty.http
exports org.eclipse.jetty.http.pathmap;
requires transitive org.eclipse.jetty.io;
requires org.slf4j;
uses HttpFieldPreEncoder;

View File

@ -24,9 +24,9 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.jetty.http.HttpParser.State;
import org.eclipse.jetty.logging.StacklessLogging;
import org.eclipse.jetty.toolchain.test.Net;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.log.StacklessLogging;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.BeforeEach;

View File

@ -1,4 +1,4 @@
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
# Jetty Logging using jetty-slf4j-impl
#org.eclipse.jetty.LEVEL=DEBUG
#org.eclipse.jetty.server.LEVEL=DEBUG
#org.eclipse.jetty.http.LEVEL=DEBUG

View File

@ -22,4 +22,5 @@ module org.eclipse.jetty.http2.client
requires org.eclipse.jetty.alpn.client;
requires transitive org.eclipse.jetty.http2.common;
requires org.slf4j;
}

View File

@ -72,6 +72,7 @@ import org.eclipse.jetty.http2.server.HTTP2ServerConnectionFactory;
import org.eclipse.jetty.io.AbstractEndPoint;
import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.io.WriteFlusher;
import org.eclipse.jetty.logging.StacklessLogging;
import org.eclipse.jetty.server.HttpChannel;
import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpOutput;
@ -85,7 +86,6 @@ import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.FutureCallback;
import org.eclipse.jetty.util.FuturePromise;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.log.StacklessLogging;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;

View File

@ -1,4 +1,4 @@
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
# Jetty Logging using jetty-slf4j-impl
#org.eclipse.jetty.LEVEL=DEBUG
#org.eclipse.jetty.http2.LEVEL=DEBUG
org.eclipse.jetty.http2.hpack.LEVEL=INFO

View File

@ -26,4 +26,5 @@ module org.eclipse.jetty.http2.common
exports org.eclipse.jetty.http2.parser;
requires transitive org.eclipse.jetty.http2.hpack;
requires org.slf4j;
}

View File

@ -1,2 +1,2 @@
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
# Jetty Logging using jetty-slf4j-impl
org.eclipse.jetty.http2.LEVEL=INFO

View File

@ -24,6 +24,7 @@ module org.eclipse.jetty.http2.hpack
exports org.eclipse.jetty.http2.hpack;
requires transitive org.eclipse.jetty.http;
requires org.slf4j;
provides HttpFieldPreEncoder with HpackFieldPreEncoder;
}

View File

@ -1,3 +1,3 @@
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
# Jetty Logging using jetty-slf4j-impl
#org.eclipse.jetty.http2.LEVEL=DEBUG
#org.eclipse.jetty.http2.hpack.LEVEL=DEBUG

View File

@ -23,4 +23,5 @@ module org.eclipse.jetty.http2.http.client.transport
requires org.eclipse.jetty.alpn.client;
requires transitive org.eclipse.jetty.client;
requires transitive org.eclipse.jetty.http2.client;
requires org.slf4j;
}

View File

@ -1,4 +1,4 @@
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
# Jetty Logging using jetty-slf4j-impl
#org.eclipse.jetty.LEVEL=DEBUG
#org.eclipse.jetty.client.LEVEL=DEBUG
org.eclipse.jetty.http2.hpack.LEVEL=INFO

View File

@ -22,4 +22,5 @@ module org.eclipse.jetty.http2.server
requires transitive org.eclipse.jetty.http2.common;
requires transitive org.eclipse.jetty.server;
requires org.slf4j;
}

View File

@ -60,12 +60,12 @@ import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.io.ChannelEndPoint;
import org.eclipse.jetty.io.ManagedSelector;
import org.eclipse.jetty.io.SocketChannelEndPoint;
import org.eclipse.jetty.logging.StacklessLogging;
import org.eclipse.jetty.server.HttpChannel;
import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.log.StacklessLogging;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;

View File

@ -1,4 +1,4 @@
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
# Jetty Logging using jetty-slf4j-impl
#org.eclipse.jetty.LEVEL=DEBUG
#org.eclipse.jetty.http2.LEVEL=DEBUG
org.eclipse.jetty.http2.hpack.LEVEL=INFO

View File

@ -22,4 +22,5 @@ module org.eclipse.jetty.io
exports org.eclipse.jetty.io.ssl;
requires transitive org.eclipse.jetty.util;
requires org.slf4j;
}

View File

@ -32,10 +32,10 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.jetty.logging.StacklessLogging;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.FutureCallback;
import org.eclipse.jetty.util.log.StacklessLogging;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;

View File

@ -1,4 +1,4 @@
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
# Jetty Logging using jetty-slf4j-impl
#org.eclipse.jetty.LEVEL=DEBUG
#org.eclipse.jetty.io.AbstractConnection.LEVEL=DEBUG
#org.eclipse.jetty.io.ManagedSelector.LEVEL=DEBUG

View File

@ -23,6 +23,7 @@ module org.eclipse.jetty.jaas
exports org.eclipse.jetty.jaas.spi;
requires transitive org.eclipse.jetty.security;
requires org.slf4j;
// Only required if using JDBCLoginModule.
requires static java.sql;

View File

@ -28,6 +28,7 @@ module org.eclipse.jetty.security.jaspi
requires javax.security.auth.message;
requires jetty.servlet.api;
requires transitive org.eclipse.jetty.security;
requires org.slf4j;
provides Authenticator.Factory with JaspiAuthenticatorFactory;
}

View File

@ -23,6 +23,7 @@ module org.eclipse.jetty.jmx
// Applications that use ObjectMBean must use JMX classes too.
requires transitive java.management;
requires transitive org.eclipse.jetty.util;
requires org.slf4j;
// Only required if using ConnectorServer.
requires static java.management.rmi;

View File

@ -1,60 +0,0 @@
//
// ========================================================================
// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others.
//
// This program and the accompanying materials are made available under
// the terms of the Eclipse Public License 2.0 which is available at
// https://www.eclipse.org/legal/epl-2.0
//
// This Source Code may also be made available under the following
// Secondary Licenses when the conditions for such availability set
// forth in the Eclipse Public License, v. 2.0 are satisfied:
// the Apache License v2.0 which is available at
// https://www.apache.org/licenses/LICENSE-2.0
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
// ========================================================================
//
package org.eclipse.jetty.util.log.jmx;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jetty.jmx.ObjectMBean;
import org.eclipse.jetty.util.annotation.ManagedAttribute;
import org.eclipse.jetty.util.annotation.ManagedObject;
import org.eclipse.jetty.util.annotation.ManagedOperation;
import org.eclipse.jetty.util.annotation.Name;
import org.eclipse.jetty.util.log.Log;
/**
*
*/
@ManagedObject("Jetty Logging")
public class LogMBean extends ObjectMBean
{
public LogMBean(Object managedObject)
{
super(managedObject);
}
@ManagedAttribute(value = "list of instantiated loggers")
public List<String> getLoggers()
{
List<String> keySet = new ArrayList<String>(Log.getLoggers().keySet());
return keySet;
}
@ManagedOperation(value = "true if debug enabled for the given logger")
public boolean isDebugEnabled(@Name("logger") String logger)
{
return Log.getLogger(logger).isDebugEnabled();
}
@ManagedOperation(value = "Set debug enabled for given logger")
public void setDebugEnabled(@Name("logger") String logger, @Name("enabled") Boolean enabled)
{
Log.getLogger(logger).setDebugEnabled(enabled);
}
}

View File

@ -26,7 +26,6 @@ import com.openpojo.validation.Validator;
import com.openpojo.validation.ValidatorBuilder;
import com.openpojo.validation.test.impl.GetterTester;
import com.openpojo.validation.test.impl.SetterTester;
import org.eclipse.jetty.util.log.jmx.LogMBean;
import org.junit.jupiter.api.Test;
/*
@ -38,7 +37,7 @@ public class PojoTest
public void testOpenPojo()
{
Validator validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester()).build();
List<Class> classes = Arrays.asList(MBeanContainer.class, ObjectMBean.class, LogMBean.class);
List<Class> classes = Arrays.asList(MBeanContainer.class, ObjectMBean.class);
for (Class clazz : classes)
{
validator.validate(PojoClassFactory.getPojoClass(clazz));

View File

@ -1,60 +0,0 @@
//
// ========================================================================
// Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others.
//
// This program and the accompanying materials are made available under
// the terms of the Eclipse Public License 2.0 which is available at
// https://www.eclipse.org/legal/epl-2.0
//
// This Source Code may also be made available under the following
// Secondary Licenses when the conditions for such availability set
// forth in the Eclipse Public License, v. 2.0 are satisfied:
// the Apache License v2.0 which is available at
// https://www.apache.org/licenses/LICENSE-2.0
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
// ========================================================================
//
package org.eclipse.jetty.util.log.jmx;
import com.acme.Managed;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.in;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class LogMBeanTest
{
private Managed managed;
private LogMBean logMBean;
private static final String MANAGED_CLASS = "Managed";
@BeforeEach
public void setUp()
{
managed = new Managed();
logMBean = new LogMBean(managed);
}
@Test
public void testKeySet()
{
// given
assertThat("Managed is not registered with loggers", MANAGED_CLASS, not(is(in(logMBean.getLoggers()))));
// when
logMBean.setDebugEnabled(MANAGED_CLASS, true);
// then
assertThat("Managed must be registered with loggers", MANAGED_CLASS, is(in(logMBean.getLoggers())));
assertTrue(logMBean.isDebugEnabled(MANAGED_CLASS), "This must return true as debug is enabled for this class");
}
}

View File

@ -1,2 +1,2 @@
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
# Jetty Logging using jetty-slf4j-impl
#org.eclipse.jetty.jmx.LEVEL=DEBUG

View File

@ -25,6 +25,7 @@ module org.eclipse.jetty.jndi
requires transitive java.naming;
requires transitive org.eclipse.jetty.server;
requires org.slf4j;
// Only required if using DataSourceCloser.
requires static java.sql;

View File

@ -236,6 +236,11 @@
<artifactId>apache-jstl</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>jakarta.transaction</groupId>
<artifactId>jakarta.transaction-api</artifactId>
@ -259,9 +264,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<configuration>
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
</configuration>
<reportSets>
<reportSet>
<reports>

View File

@ -19,6 +19,7 @@
<!--maven.compiler.release>11</maven.compiler.release-->
<jetty.port.file>${project.build.directory}/jetty-run-mojo-annotation.txt</jetty.port.file>
<jetty.deployMode>EMBED</jetty.deployMode>
<logging.slf4j.version>1.7.30</logging.slf4j.version>
</properties>
<dependencies>
@ -41,12 +42,17 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>@slf4j.version@</version>
<version>${logging.slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j18-impl</artifactId>
<version>@log4j2.version@</version>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${logging.slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<version>${logging.slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
@ -87,9 +93,7 @@
<systemProperties>
<jetty.port.file>${jetty.port.file}</jetty.port.file>
</systemProperties>
<jettyXmls>
<jettyXml>${basedir}/src/config/jetty.xml</jettyXml>
</jettyXmls>
<jettyXml>${basedir}/src/config/jetty.xml</jettyXml>
</configuration>
</execution>
</executions>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration debug="false" xmlns:log4j='http://jakarta.apache.org/log4j/'>
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} [%p] :%t: (%c) - %m%n" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="console" />
</root>
</log4j:configuration>

View File

@ -20,7 +20,6 @@ package test;
import java.net.URL;
import java.net.URLClassLoader;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

View File

@ -1,9 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<!-- Servlets -->
<!-- Servlets -->
<servlet>
<servlet-name>greetServlet</servlet-name>
<servlet-class>org.olamy.GreetingServiceImpl</servlet-class>

View File

@ -23,8 +23,8 @@ import java.util.List;
import java.util.Map;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* AbstractForker
@ -33,7 +33,7 @@ import org.eclipse.jetty.util.log.Logger;
*/
public abstract class AbstractForker extends AbstractLifeCycle
{
private static final Logger LOG = Log.getLogger(AbstractForker.class);
private static final Logger LOG = LoggerFactory.getLogger(AbstractForker.class);
protected Map<String,String> env;
@ -245,7 +245,7 @@ public abstract class AbstractForker extends AbstractLifeCycle
int attempts = maxChildStartChecks;
while (!tokenFile.exists() && attempts > 0)
{
Thread.currentThread().sleep(maxChildStartCheckMs);
Thread.sleep(maxChildStartCheckMs);
--attempts;
}
if (attempts <= 0)

View File

@ -680,7 +680,7 @@ public abstract class AbstractWebAppMojo extends AbstractMojo
for (Object obj : pluginArtifacts)
{
Artifact artifact = (Artifact)obj;
if ("jar".equals(artifact.getType()) && !artifact.getGroupId().contains("slf4j"))
if ("jar".equals(artifact.getType()))
{
if (classPath.length() > 0)
classPath.append(File.pathSeparator);
@ -689,7 +689,7 @@ public abstract class AbstractWebAppMojo extends AbstractMojo
else
{
if (artifact.getArtifactId().equals(plugin.getArtifactId())) //get the jetty-maven-plugin jar
classPath.append(artifact.getFile().getAbsolutePath());
classPath.append(artifact.getFile().getAbsolutePath());
}
}

View File

@ -33,9 +33,9 @@ import org.eclipse.jetty.util.PathWatcher;
import org.eclipse.jetty.util.PathWatcher.PathWatchEvent;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* JettyForkedChild
@ -45,7 +45,7 @@ import org.eclipse.jetty.util.resource.Resource;
*/
public class JettyForkedChild extends AbstractLifeCycle
{
private static final Logger LOG = Log.getLogger(JettyForkedChild.class);
private static final Logger LOG = LoggerFactory.getLogger(JettyForkedChild.class);
protected JettyEmbedder jetty;
protected File tokenFile;

View File

@ -23,12 +23,12 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.webapp.Configuration;
import org.eclipse.jetty.webapp.MetaInfConfiguration;
import org.eclipse.jetty.webapp.WebAppContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* MavenWebInfConfiguration
@ -38,7 +38,7 @@ import org.eclipse.jetty.webapp.WebAppContext;
*/
public class MavenMetaInfConfiguration extends MetaInfConfiguration
{
private static final Logger LOG = Log.getLogger(MavenMetaInfConfiguration.class);
private static final Logger LOG = LoggerFactory.getLogger(MavenMetaInfConfiguration.class);
protected static int COUNTER = 0;

View File

@ -20,19 +20,19 @@ package org.eclipse.jetty.maven.plugin;
import org.eclipse.jetty.quickstart.QuickStartConfiguration;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.resource.ResourceCollection;
import org.eclipse.jetty.webapp.Configuration;
import org.eclipse.jetty.webapp.WebAppContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* MavenQuickStartConfiguration
*/
public class MavenQuickStartConfiguration extends QuickStartConfiguration
{
private static final Logger LOG = Log.getLogger(QuickStartConfiguration.class);
private static final Logger LOG = LoggerFactory.getLogger(QuickStartConfiguration.class);
@Override
public Class<? extends Configuration> replaces()

View File

@ -37,14 +37,14 @@ import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.servlet.ServletMapping;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.URIUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.resource.ResourceCollection;
import org.eclipse.jetty.webapp.Configuration;
import org.eclipse.jetty.webapp.Configurations;
import org.eclipse.jetty.webapp.MetaInfConfiguration;
import org.eclipse.jetty.webapp.WebAppContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* MavenWebAppContext
@ -56,7 +56,7 @@ import org.eclipse.jetty.webapp.WebAppContext;
*/
public class MavenWebAppContext extends WebAppContext
{
private static final Logger LOG = Log.getLogger(MavenWebAppContext.class);
private static final Logger LOG = LoggerFactory.getLogger(MavenWebAppContext.class);
private static final String DEFAULT_CONTAINER_INCLUDE_JAR_PATTERN = ".*/javax.servlet-[^/]*\\.jar$|.*/jetty-servlet-api-[^/]*\\.jar$|.*javax.servlet.jsp.jstl-[^/]*\\.jar|.*taglibs-standard-impl-.*\\.jar";
@ -425,7 +425,7 @@ public class MavenWebAppContext extends WebAppContext
}
catch (IOException e)
{
LOG.ignore(e);
LOG.trace("IGNORED", e);
}
}
return resource;

View File

@ -20,12 +20,12 @@ package org.eclipse.jetty.maven.plugin;
import java.io.File;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.webapp.Configuration;
import org.eclipse.jetty.webapp.WebAppClassLoader;
import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.webapp.WebInfConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* MavenWebInfConfiguration
@ -35,7 +35,7 @@ import org.eclipse.jetty.webapp.WebInfConfiguration;
*/
public class MavenWebInfConfiguration extends WebInfConfiguration
{
private static final Logger LOG = Log.getLogger(MavenWebInfConfiguration.class);
private static final Logger LOG = LoggerFactory.getLogger(MavenWebInfConfiguration.class);
public MavenWebInfConfiguration()
{

View File

@ -35,9 +35,9 @@ import org.codehaus.plexus.util.SelectorUtils;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.URIUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.JarResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* SelectiveJarResource
@ -46,7 +46,7 @@ import org.eclipse.jetty.util.resource.JarResource;
*/
public class SelectiveJarResource extends JarResource
{
private static final Logger LOG = Log.getLogger(SelectiveJarResource.class);
private static final Logger LOG = LoggerFactory.getLogger(SelectiveJarResource.class);
/**
* Default matches every resource.

View File

@ -42,11 +42,11 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertNotNull;
/**
* Test the JettyForkedChild class, which
* is the main that is executed by jetty:run/start in mode FORKED.
*
*/
public class TestForkedChild
{
@ -107,11 +107,14 @@ public class TestForkedChild
testDir.mkdirs();
tmpDir = new File(testDir, "tmp");
webappPropsFile = new File(testDir, "webapp.props");
stopPort = Integer.valueOf(System.getProperty("stop.port"));
String stopPortString = System.getProperty("stop.port");
assertNotNull(stopPortString, "stop.port System property");
stopPort = Integer.valueOf(stopPortString);
jettyPortString = System.getProperty("jetty.port");
assertNotNull(jettyPortString, "jetty.port System property");
jettyPort = Integer.valueOf(jettyPortString);
Random random = new Random();
token = Long.toString(random.nextLong() ^ System.currentTimeMillis(), 36).toUpperCase(Locale.ENGLISH);
tokenFile = testDir.toPath().resolve(token + ".txt").toFile();

View File

@ -33,10 +33,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
*
*
*/
public class TestJettyEmbedder
{
@ -82,7 +78,7 @@ public class TestJettyEmbedder
MavenWebAppContext webApp = new MavenWebAppContext();
Server server = new Server();
Map<String,String> jettyProperties = new HashMap<>();
jettyProperties.put("jetty.server.dumpAfterStart", "true");
jettyProperties.put("jetty.server.dumpAfterStart", "false");
ContextHandler otherHandler = new ContextHandler();
otherHandler.setContextPath("/other");

View File

@ -35,6 +35,7 @@ import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.instanceOf;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
@ -152,7 +153,7 @@ public class TestWebAppPropertyConverter
assertEquals(true, webApp.isPersistTempDirectory());
assertEquals(war.getAbsolutePath(), webApp.getWar());
assertEquals(webXml.getAbsolutePath(), webApp.getDescriptor());
assertTrue(webApp.getBaseResource() instanceof ResourceCollection);
assertThat(webApp.getBaseResource(), instanceOf(ResourceCollection.class));
assertThat(webApp.getBaseResource().toString(), Matchers.containsString(Resource.newResource(base1).toString()));
assertThat(webApp.getBaseResource().toString(), Matchers.containsString(Resource.newResource(base2).toString()));
}

View File

@ -75,7 +75,7 @@ public class IntegrationTestGetContent
}
String response = httpClient.GET(url).getContentAsString();
assertTrue(response.contains(contentCheck), "it test " + System.getProperty("maven.it.name") +
", response not contentCheck: " + contentCheck + ", response:" + response);
", response not contentCheck: " + contentCheck + ", response:" + response);
System.out.println("contentCheck");
}
if (Boolean.getBoolean("helloTestServlet"))
@ -104,8 +104,9 @@ public class IntegrationTestGetContent
int attempts = 70;
int port = -1;
String s = System.getProperty("jetty.port.file");
assertNotNull(s);
assertNotNull(s, "jetty.port.file System property");
Path p = Paths.get(s);
System.err.println("Looking for port file: " + p);
while (true)
{
if (Files.exists(p))
@ -127,8 +128,9 @@ public class IntegrationTestGetContent
}
else
{
Thread.currentThread().sleep(1000);
Thread.sleep(1000);
}
System.err.printf(" attempts left: #%d%n", attempts);
}
}
return port;

View File

@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/embedder</Set>
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/embedder</Set>
</Configure>

View File

@ -8,7 +8,7 @@ session
[depends]
session-store
slf4j-api
logging/slf4j
[files]
maven://com.googlecode.xmemcached/xmemcached/2.4.5|lib/xmemcached/xmemcached-2.4.5.jar

Some files were not shown because too many files have changed in this diff Show More