Skip to content

Commit

Permalink
Issue #4572 - Migrating jetty-home logging modules
Browse files Browse the repository at this point in the history
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
  • Loading branch information
joakime committed Feb 20, 2020
1 parent ded899f commit e49e5ab
Show file tree
Hide file tree
Showing 54 changed files with 408 additions and 616 deletions.
32 changes: 32 additions & 0 deletions jetty-home/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
26 changes: 26 additions & 0 deletions jetty-home/src/main/resources/modules/logging-jetty.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 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]
resources

[provides]
logging|default

[files]
basehome:modules/logging-jetty

[lib]
lib/logging/slf4j-api-${slf4j.version}.jar
lib/logging/jetty-slf4j-impl-${jetty.version}.jar

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

Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
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.
Configure jetty logging to use Java Util Logging (jul)
SLF4J is used as the core logging mechanism.

[tags]
logging
slf4j
internal

[depends]
resources

[provides]
logging

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

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

[ini]
slf4j.version?=1.8.0-beta2
jetty.webapp.addServerClasses+=,${jetty.base.uri}/lib/slf4j/
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/

[license]
SLF4J is distributed under the MIT License.
Expand All @@ -42,3 +48,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.


Original file line number Diff line number Diff line change
@@ -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


54 changes: 54 additions & 0 deletions jetty-home/src/main/resources/modules/logging-log4j1.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# 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]
resources

[provides]
logging

[files]
basehome:modules/logging-log4j1

[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

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

[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.

Log4j is released under the Apache 2.0 license.
http://www.apache.org/licenses/LICENSE-2.0.html
Original file line number Diff line number Diff line change
@@ -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>
32 changes: 32 additions & 0 deletions jetty-home/src/main/resources/modules/logging-log4j2.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# 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]
resources

[provides]
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

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

[license]
Log4j is released under the Apache 2.0 license.
http://www.apache.org/licenses/LICENSE-2.0.html
Original file line number Diff line number Diff line change
@@ -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="debug">
<AppenderRef ref="LogToConsole" />
</Root>
</Loggers>
</Configuration>
44 changes: 44 additions & 0 deletions jetty-home/src/main/resources/modules/logging-logback.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# 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]
resources

[provides]
logging

[files]
basehome:modules/logging-logback

[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

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

[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
Original file line number Diff line number Diff line change
@@ -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="debug">
<appender-ref ref="STDOUT" />
</root>
</configuration>
2 changes: 1 addition & 1 deletion jetty-maven-plugin/src/it/javax-annotation-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>slf4j-impl</artifactId>
<artifactId>log4j-slf4j18-impl</artifactId>
<version>@log4j2.version@</version>
</dependency>
<dependency>
Expand Down
3 changes: 3 additions & 0 deletions jetty-server/src/main/config/modules/bytebufferpool.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-m
[description]
Configures the ByteBufferPool used by ServerConnectors.

[depends]
logging

[xml]
etc/jetty-bytebufferpool.xml

Expand Down
4 changes: 2 additions & 2 deletions jetty-server/src/main/config/modules/server.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
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]
Enables the core Jetty server on the classpath.
Expand All @@ -7,11 +7,11 @@ Enables the core Jetty server on the classpath.
jvm
ext
resources
logging

[depend]
threadpool
bytebufferpool
logging

[lib]
lib/jetty-servlet-api-4.0.*.jar
Expand Down
3 changes: 3 additions & 0 deletions jetty-server/src/main/config/modules/threadpool.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-m
[description]
Enables the Server thread pool.

[depends]
logging

[xml]
etc/jetty-threadpool.xml

Expand Down
Loading

0 comments on commit e49e5ab

Please sign in to comment.