Merge branch 'jetty-9.4.x'
This commit is contained in:
commit
93741c32a8
|
@ -20,7 +20,7 @@ node {
|
|||
{
|
||||
stage 'Compile'
|
||||
withEnv(mvnEnv) {
|
||||
timeout(15) {
|
||||
timeout(time: 15, unit: 'MINUTES') {
|
||||
sh "mvn -B clean install -Dtest=None"
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ node {
|
|||
{
|
||||
stage 'Javadoc'
|
||||
withEnv(mvnEnv) {
|
||||
timeout(15) {
|
||||
timeout(time: 15, unit: 'MINUTES') {
|
||||
sh "mvn -B javadoc:javadoc"
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ node {
|
|||
{
|
||||
stage 'Test'
|
||||
withEnv(mvnEnv) {
|
||||
timeout(60) {
|
||||
timeout(time: 60, unit: 'MINUTES') {
|
||||
// Run test phase / ignore test failures
|
||||
sh "mvn -B install -Dmaven.test.failure.ignore=true"
|
||||
// Report failures in the jenkins UI
|
||||
|
@ -54,6 +54,7 @@ node {
|
|||
testResults: '**/target/surefire-reports/TEST-*.xml'])
|
||||
// Collect up the jacoco execution results
|
||||
step([$class: 'JacocoPublisher',
|
||||
inclusionPattern: "**/org/eclipse/jetty/**/*.class",
|
||||
execPattern: '**/target/jacoco.exec',
|
||||
classPattern: '**/target/classes',
|
||||
sourcePattern: '**/src/main/java'])
|
||||
|
|
|
@ -64,9 +64,8 @@ A typical jetty-logging.properties file will include at least the declaration of
|
|||
Examples for various logging frameworks can be found later in this documentation.
|
||||
|
||||
* Default Logging with link:#default-logging-with-stderrlog[Jetty's StdErrLog]
|
||||
* Using link:#example-logging-log4j[Log4j via Slf4jLog]
|
||||
* Using link:#example-logging-logback[Logback via Slf4jLog]
|
||||
* Using java.util.logging via Slf4jLog
|
||||
* Using java.util.logging via Jetty's JavaUtilLog
|
||||
* Capturing link:#example-slf4j-multiple-loggers[Multiple Logging Frameworks via Slf4jLog]
|
||||
* Using link:#example-logging-log4j[Log4j or Log4j2 via SLF4J]
|
||||
* Using link:#example-logging-logback[Logback via SLF4J]
|
||||
* Using link:#example-logging-java-util-logging[Java Util Logging via SLF4J]
|
||||
* Using link:#example-logging-java-commons-logging[Java Commons Logging via SLF4J]
|
||||
* link:#example-logging-logback-centralized[Centralized Logging with Logback and Sfl4jLog]
|
||||
|
|
|
@ -15,37 +15,74 @@
|
|||
// ========================================================================
|
||||
|
||||
[[configuring-logging-modules]]
|
||||
=== Jetty Logging Integrations (Slf4j, Log4j, Logback, JCL, JUL)
|
||||
=== Jetty Logging Integrations (SLF4J, Log4j, Logback, JCL, JUL)
|
||||
|
||||
Jetty provides support for several logging frameworks including SLF4J, Java Commons Logging (jcl), Java Util Logging (jul), Log4j (including version 2), and Logback.
|
||||
Jetty provides support for several logging frameworks including SLF4J, Java Commons Logging (JCL), Java Util Logging (JUL), Log4j (including version 2), and Logback.
|
||||
This page includes examples of how to enable the associated modules for these different frameworks.
|
||||
These modules are designed to capture container/server logs; link:#configuring-jetty-request-logs[request logs] and application logs need to be configured separately.
|
||||
Please note that enabling these modules provides typical and basic functionality for each framework; advanced implementations may require their link:#startup-modules[own modules] or additional configuration.
|
||||
|
||||
Enabling these frameworks in the Jetty distribution is as easy as activating any other module, by adding `--add-to-start=<module name>` to the start command for your server, such as:
|
||||
|
||||
[source, screen, subs="{sub-order}"]
|
||||
....
|
||||
$ java -jar ../start.jar --add-to-start=logging-jetty
|
||||
[my-base]$ java -jar ../start.jar --add-to-start=logging-jetty
|
||||
INFO : logging-jetty initialized in ${jetty.base}/start.d/logging-jetty.ini
|
||||
INFO : resources transitive
|
||||
INFO : Base directory was modified
|
||||
....
|
||||
|
||||
As noted above, Jetty supports a wide array of logging technologies.
|
||||
The release of Jetty 9.4 made the implementation of these frameworks easier by providing logging modules that contain all the dependencies needed to implement a specific technology.
|
||||
If a particular logging framework requires additional jar files, Jetty will automatically download these as part of enabling the associated module.
|
||||
You can view a list of all the Jetty modules by running `java -jar <path-to-jetty.home>/start.jar --list-modules`.
|
||||
If a particular logging framework requires additional jar files, Jetty will automatically download these as part of enabling the associated module and any dependent modules will be transitively enabled.
|
||||
|
||||
A list of the base Jetty logging modules by running `java -jar <path-to-jetty.home>/start.jar --list-modules=logging,-internal`.
|
||||
|
||||
logging-jcl::
|
||||
Configures Jetty logging to use Java Commons Logging (JCL), using SLF4J as a binding.
|
||||
logging-jetty::
|
||||
Standard Jetty logging that captures `System.err` and `System.out` output.
|
||||
logging-jul::
|
||||
Configures Jetty logging to use Java Util Logging (JUL), using SLF4J as a binding.
|
||||
logging-log4j::
|
||||
Configures Jetty logging to use Log4j as the logging implementation, using SLF4J as a binding.
|
||||
logging-log4j2::
|
||||
Configures Jetty logging to use Log4j2 as the logging implementation, using SLF4J as a binding.
|
||||
logging-logback::
|
||||
Configures Jetty logging to use Logback as the logging implementation, using SLF4J as a binding.
|
||||
logging-slf4j::
|
||||
Configures Jetty logging to use SLF4J and provides a `slf4j-impl` which can be used by other logging frameworks.
|
||||
If no other logging is configured, `slf4j-simple` is used.
|
||||
|
||||
You can view a list of *all* the Jetty logging modules by running `java -jar <path-to-jetty.home>/start.jar --list-modules=logging`.
|
||||
This will display all logging modules, including implementation and binding modules.
|
||||
|
||||
All these modules (with the exception of `logging-jetty`) arrange for the Jetty private logging API to be routed to the named technology to actually be logged.
|
||||
For example, enabling the `logging-log4j` module will do several things:
|
||||
|
||||
* it enables an internal Log4j API module so that any container code that uses Log4j will find the API.
|
||||
* it enables an internal Log4j Implementation so that any container code that uses the Log4j API will also use a Log4j implementation to handle the logs (and all the normal Log4j configuration mechanisms etc.)
|
||||
* it enables the internal `slf4j-log4j` logging binding so that any container code that uses the SLF4j API to also use the Log4j implementation via the Log4j API.
|
||||
* it configures the Jetty logging API to use the SLF4J API, which is then bound to Log4j.
|
||||
|
||||
So, after enabling `logging-log4j`, within the server container there are 3 logging APIs available: Jetty, SLF4J and Log4J.
|
||||
But there is only a single logging *implementation* - Log4j; the 3 APIs act only as facades over the Log4j implementation.
|
||||
|
||||
Note that you can add additional APIs to this configuration.
|
||||
For example, enabling the internal module `jcl-slf4j` would add in a Java Commons Logging facade that also would use the Log4j implementation via the SLF4J binding.
|
||||
|
||||
Most other top level logging modules work in the same way: `logging-jcl`, `logging-jul`, `logging-slf4j`, `logging-log4j2` and `logging-logback` all bind their implementation via SLF4J.
|
||||
|
||||
[[example-logging-slf4j]]
|
||||
==== Logging with SLF4J
|
||||
|
||||
===== jetty-slf4j
|
||||
|
||||
Jetty uses the Slf4j api as a bridge to provide logging information to additional frameworks such as Log4j or Logback.
|
||||
It can also be used itself to provide logging in conjunction with standard Jetty logging.
|
||||
To enable the Slf4j framework, you need to activate the `logging-slf4j` module.
|
||||
Jetty uses the SLF4J api as a binding to provide logging information to additional frameworks such as Log4j or Logback.
|
||||
It can also be used on it's own to provide simple server logging.
|
||||
To enable the SLF4J framework, you need to activate the `logging-slf4j` module.
|
||||
By default, log files will be stored in `${jetty.base}/logs`.
|
||||
|
||||
[source, screen, subs="{sub-order}"]
|
||||
....
|
||||
$ java -jar ../start.jar --add-to-start=logging-slf4j
|
||||
[my-base]$ java -jar ../start.jar --add-to-start=logging-slf4j
|
||||
|
||||
ALERT: There are enabled module(s) with licenses.
|
||||
The following 1 module(s):
|
||||
|
@ -75,34 +112,59 @@ The following 1 module(s):
|
|||
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Proceed (y/N)? y
|
||||
INFO : slf4j-api transitive, ini template available with --add-to-start=slf4j-api
|
||||
INFO : logging-slf4j initialized in ${jetty.base}/start.d/logging-slf4j.ini
|
||||
INFO : slf4j-impl transitive
|
||||
INFO : slf4j-api transitively enabled
|
||||
INFO : logging-slf4j initialized in ${jetty.base}/start.d/logging-slf4j.ini
|
||||
MKDIR : ${jetty.base}/lib/slf4j
|
||||
DOWNLOAD: http://central.maven.org/maven2/org/slf4j/slf4j-api/1.7.21/slf4j-api-1.7.21.jar to ${jetty.base}/lib/slf4j/slf4j-api-1.7.21.jar
|
||||
DOWNLOAD: http://central.maven.org/maven2/org/slf4j/slf4j-simple/1.7.21/slf4j-simple-1.7.21.jar to ${jetty.base}/lib/slf4j/slf4j-simple-1.7.21.jar
|
||||
INFO : Base directory was modified
|
||||
INFO : Base directory was modified
|
||||
ERROR : Module logging-slf4j requires a `slf4j-impl` module from one of [slf4j-simple-impl, slf4j-logback, slf4j-jul, slf4j-jcl, slf4j-log4j2, slf4j-log4j]
|
||||
|
||||
$ tree
|
||||
ERROR : Unsatisfied module dependencies: logging-slf4j
|
||||
|
||||
Usage: java -jar $JETTY_HOME/start.jar [options] [properties] [configs]
|
||||
java -jar $JETTY_HOME/start.jar --help # for more information
|
||||
....
|
||||
|
||||
As you probably noticed, the system gives an `ERROR` when trying to enable the `logging-slf4j` on it's own.
|
||||
The `logging-slf4j` module itself provides the SLF4J api, but as SLF4J is often used as a binding for other logging frameworks does not by default provide an implementation.
|
||||
To enable the simple SLF4J implementation, we will also need to activate the `slf4j-simple-impl` module.
|
||||
|
||||
[source, screen, subs="{sub-order}"]
|
||||
....
|
||||
[my-base]$ java -jar ../start.jar --add-to-start=slf4j-simple-impl
|
||||
INFO : slf4j-simple-impl initialized in ${jetty.base}/start.d/slf4j-simple-impl.ini
|
||||
INFO : resources transitively enabled
|
||||
DOWNLOAD: http://central.maven.org/maven2/org/slf4j/slf4j-simple/1.7.21/slf4j-simple-1.7.21.jar to ${jetty.base}/lib/slf4j/slf4j-simple-1.7.21.jar
|
||||
MKDIR : ${jetty.base}/resources
|
||||
COPY : ${jetty.home}/modules/slf4j/simplelogger.properties to ${jetty.base}/resources/simplelogger.properties
|
||||
MKDIR : ${jetty.base}/logs
|
||||
INFO : Base directory was modified
|
||||
|
||||
[my-base]$ tree
|
||||
.
|
||||
├── lib
|
||||
│ └── slf4j
|
||||
│ ├── slf4j-api-1.7.21.jar
|
||||
│ └── slf4j-simple-1.7.21.jar
|
||||
├── logs
|
||||
├── resources
|
||||
│ └── simplelogger.properties
|
||||
└── start.d
|
||||
├── logging-slf4j.ini
|
||||
└── slf4j-simple-impl.ini
|
||||
....
|
||||
|
||||
|
||||
[[example-logging-log4j]]
|
||||
==== Logging with Log4j and log4j2
|
||||
==== Logging with Log4j and Log4j2
|
||||
|
||||
It is possible to have the Jetty Server logging configured so that Log4j or Log4j2 controls the output of logging events produced by Jetty.
|
||||
This is accomplished by configuring Jetty for logging to http://logging.apache.org/log4j/[Apache Log4j] via http://slf4j.org/manual.html[Slf4j] and the http://slf4j.org/manual.html#swapping[Slf4j binding layer for Log4j].
|
||||
Implementation of Log4j can be done by enabling the `logging-log4j` module.
|
||||
By default, log files will be stored in `${jetty.base}/logs`.
|
||||
|
||||
[source, screen, subs="{sub-order}"]
|
||||
....
|
||||
$ java -jar ../start.jar --add-to-start=logging-log4j
|
||||
[my-base]$ java -jar ../start.jar --add-to-start=logging-log4j
|
||||
|
||||
ALERT: There are enabled module(s) with licenses.
|
||||
The following 2 module(s):
|
||||
|
@ -136,17 +198,22 @@ The following 2 module(s):
|
|||
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Proceed (y/N)? y
|
||||
INFO : slf4j-api transitive, ini template available with --add-to-start=slf4j-api
|
||||
INFO : log4j-impl transitive, ini template available with --add-to-start=log4j-impl
|
||||
INFO : resources transitive
|
||||
INFO : slf4j-log4j transitive
|
||||
INFO : logging-log4j initialized in ${jetty.base}/start.d/logging-log4j.ini
|
||||
INFO : slf4j-api transitively enabled
|
||||
INFO : log4j-impl transitively enabled
|
||||
INFO : resources transitively enabled
|
||||
INFO : slf4j-log4j transitively enabled
|
||||
INFO : logging-log4j initialized in ${jetty.base}/start.d/logging-log4j.ini
|
||||
MKDIR : ${jetty.base}/lib/slf4j
|
||||
DOWNLOAD: http://central.maven.org/maven2/org/slf4j/slf4j-api/1.7.21/slf4j-api-1.7.21.jar to ${jetty.base}/lib/slf4j/slf4j-api-1.7.21.jar
|
||||
MKDIR : ${jetty.base}/resources
|
||||
COPY : ${jetty.home}/modules/log4j/log4j.properties to ${jetty.base}/resources/log4j.properties
|
||||
MKDIR : ${jetty.base}/lib/log4j
|
||||
DOWNLOAD: http://central.maven.org/maven2/log4j/log4j/1.2.17/log4j-1.2.17.jar to ${jetty.base}/lib/log4j/log4j-1.2.17.jar
|
||||
MKDIR : ${jetty.base}/logs
|
||||
DOWNLOAD: http://central.maven.org/maven2/org/slf4j/slf4j-log4j12/1.7.21/slf4j-log4j12-1.7.21.jar to ${jetty.base}/lib/slf4j/slf4j-log4j12-1.7.21.jar
|
||||
INFO : Base directory was modified
|
||||
INFO : Base directory was modified
|
||||
|
||||
$ tree
|
||||
[my-base]$ tree
|
||||
.
|
||||
├── lib
|
||||
│ ├── log4j
|
||||
|
@ -154,17 +221,19 @@ $ tree
|
|||
│ └── slf4j
|
||||
│ ├── slf4j-api-1.7.21.jar
|
||||
│ └── slf4j-log4j12-1.7.21.jar
|
||||
├── logs
|
||||
├── resources
|
||||
│ └── log4j.properties
|
||||
└── start.d
|
||||
├── logging-log4j.ini
|
||||
└── logging-log4j.ini
|
||||
....
|
||||
|
||||
Or, to enable Log4j2, simply enable the `logging-log4j2` module.
|
||||
By default, log files will be stored in `${jetty.base}/logs`.
|
||||
|
||||
[source, screen, subs="{sub-order}"]
|
||||
....
|
||||
$ java -jar ../start.jar --add-to-start=logging-log4j2
|
||||
[my-base]$ java -jar ../start.jar --add-to-start=logging-log4j2
|
||||
|
||||
ALERT: There are enabled module(s) with licenses.
|
||||
The following 2 module(s):
|
||||
|
@ -198,32 +267,39 @@ The following 2 module(s):
|
|||
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Proceed (y/N)? y
|
||||
INFO : slf4j-api transitive, ini template available with --add-to-start=slf4j-api
|
||||
INFO : logging-log4j2 initialized in ${jetty.base}/start.d/logging-log4j2.ini
|
||||
INFO : log4j2-api transitive, ini template available with --add-to-start=log4j2-api
|
||||
INFO : resources transitive
|
||||
INFO : slf4j-log4j2 transitive
|
||||
INFO : log4j2-impl transitive
|
||||
INFO : slf4j-api transitively enabled
|
||||
INFO : logging-log4j2 initialized in ${jetty.base}/start.d/logging-log4j2.ini
|
||||
INFO : log4j2-api transitively enabled
|
||||
INFO : resources transitively enabled
|
||||
INFO : slf4j-log4j2 transitively enabled
|
||||
INFO : log4j2-impl transitively enabled
|
||||
MKDIR : ${jetty.base}/lib/slf4j
|
||||
DOWNLOAD: http://central.maven.org/maven2/org/slf4j/slf4j-api/1.7.21/slf4j-api-1.7.21.jar to ${jetty.base}/lib/slf4j/slf4j-api-1.7.21.jar
|
||||
MKDIR : ${jetty.base}/lib/log4j
|
||||
DOWNLOAD: http://central.maven.org/maven2/org/apache/logging/log4j/log4j-api/2.6.1/log4j-api-2.6.1.jar to ${jetty.base}/lib/log4j/log4j-api-2.6.1.jar
|
||||
MKDIR: ${jetty.base}/resources
|
||||
MKDIR : ${jetty.base}/resources
|
||||
DOWNLOAD: http://central.maven.org/maven2/org/apache/logging/log4j/log4j-slf4j-impl/2.6.1/log4j-slf4j-impl-2.6.1.jar to ${jetty.base}/lib/log4j/log4j-slf4j-impl-2.6.1.jar
|
||||
DOWNLOAD: http://central.maven.org/maven2/org/apache/logging/log4j/log4j-core/2.6.1/log4j-core-2.6.1.jar to ${jetty.base}/lib/log4j/log4j-core-2.6.1.jar
|
||||
INFO : Base directory was modified
|
||||
MKDIR : ${jetty.base}/lib/log4j2
|
||||
DOWNLOAD: http://central.maven.org/maven2/org/apache/logging/log4j/log4j-core/2.6.1/log4j-core-2.6.1.jar to ${jetty.base}/lib/log4j2/log4j-core-2.6.1.jar
|
||||
COPY : ${jetty.home}/modules/log4j2/log4j2.xml to ${jetty.base}/resources/log4j2.xml
|
||||
MKDIR : ${jetty.base}/logs
|
||||
INFO : Base directory was modified
|
||||
|
||||
$ tree
|
||||
[my-base]$ tree
|
||||
.
|
||||
├── lib
|
||||
│ ├── log4j
|
||||
│ │ ├── log4j-api-2.6.1.jar
|
||||
│ │ ├── log4j-core-2.6.1.jar
|
||||
│ │ └── log4j-slf4j-impl-2.6.1.jar
|
||||
│ ├── log4j2
|
||||
│ │ └── log4j-core-2.6.1.jar
|
||||
│ └── slf4j
|
||||
│ └── slf4j-api-1.7.21.jar
|
||||
├── logs
|
||||
├── resources
|
||||
│ └── log4j2.xml
|
||||
└── start.d
|
||||
├── logging-log4j2.ini
|
||||
└── logging-log4j2.ini
|
||||
....
|
||||
|
||||
[[example-logging-logback]]
|
||||
|
@ -233,10 +309,11 @@ It is possible to have the Jetty Server logging configured so that Logback contr
|
|||
This is accomplished by configuring Jetty for logging to `Logback`, which uses http://slf4j.org/manual.html[Slf4j] and the http://logback.qos.ch/[Logback Implementation for Slf4j].
|
||||
|
||||
To set up Jetty logging via Logback, enable the `logging-logback` module.
|
||||
By default, log files will be stored in `${jetty.base}/logs`.
|
||||
|
||||
[source, screen, subs="{sub-order}"]
|
||||
....
|
||||
$ java -jar ../start.jar --add-to-start=logging-logback
|
||||
[my-base]$ java -jar ../start.jar --add-to-start=logging-logback
|
||||
|
||||
ALERT: There are enabled module(s) with licenses.
|
||||
The following 2 module(s):
|
||||
|
@ -279,17 +356,22 @@ The following 2 module(s):
|
|||
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Proceed (y/N)? y
|
||||
INFO : slf4j-api transitive, ini template available with --add-to-start=slf4j-api
|
||||
INFO : logback-impl transitive, ini template available with --add-to-start=logback-impl
|
||||
INFO : slf4j-logback transitive
|
||||
INFO : logging-logback initialized in ${jetty.base}/start.d/logging-logback.ini
|
||||
INFO : resources transitive
|
||||
INFO : slf4j-api transitively enabled
|
||||
INFO : logback-impl transitively enabled
|
||||
INFO : slf4j-logback transitively enabled
|
||||
INFO : logging-logback initialized in ${jetty.base}/start.d/logging-logback.ini
|
||||
INFO : resources transitively enabled
|
||||
MKDIR : ${jetty.base}/lib/slf4j
|
||||
DOWNLOAD: http://central.maven.org/maven2/org/slf4j/slf4j-api/1.7.21/slf4j-api-1.7.21.jar to ${jetty.base}/lib/slf4j/slf4j-api-1.7.21.jar
|
||||
MKDIR : ${jetty.base}/lib/logback
|
||||
DOWNLOAD: http://central.maven.org/maven2/ch/qos/logback/logback-core/1.1.7/logback-core-1.1.7.jar to ${jetty.base}/lib/logback/logback-core-1.1.7.jar
|
||||
MKDIR : ${jetty.base}/resources
|
||||
COPY : ${jetty.home}/modules/logback/logback.xml to ${jetty.base}/resources/logback.xml
|
||||
MKDIR : ${jetty.base}/logs
|
||||
DOWNLOAD: http://central.maven.org/maven2/ch/qos/logback/logback-classic/1.1.7/logback-classic-1.1.7.jar to ${jetty.base}/lib/logback/logback-classic-1.1.7.jar
|
||||
INFO : Base directory was modified
|
||||
INFO : Base directory was modified
|
||||
|
||||
$ tree
|
||||
[my-base]$ tree
|
||||
.
|
||||
├── lib
|
||||
│ ├── logback
|
||||
|
@ -297,13 +379,15 @@ $ tree
|
|||
│ │ └── logback-core-1.1.7.jar
|
||||
│ └── slf4j
|
||||
│ └── slf4j-api-1.7.21.jar
|
||||
├── logs
|
||||
├── resources
|
||||
│ └── logback.xml
|
||||
└── start.d
|
||||
├── logging-logback.ini
|
||||
└── logging-logback.ini
|
||||
....
|
||||
|
||||
At this point Jetty is configured so that the Jetty server itself will log using Logback, using the Logback configuration found in `{$jetty.base}/resources/logback.xml`.
|
||||
Log files will be stored in `${jetty.base}/logs`.
|
||||
|
||||
==== Logging with Java Util Logging
|
||||
|
||||
|
@ -312,11 +396,11 @@ At this point Jetty is configured so that the Jetty server itself will log using
|
|||
It is possible to have the Jetty Server logging configured so that `java.util.logging` controls the output of logging events produced by Jetty.
|
||||
|
||||
This example demonstrates how to configuring Jetty for logging to `java.util.logging` via http://slf4j.org/manual.html[Slf4j] and the http://slf4j.org/manual.html#swapping[Slf4j binding layer for java.util.logging].
|
||||
If you want to use the built-in native `java.util.logging` implementation, see link:#example-logging-java-util-logging-native[Native Java Util Logging].
|
||||
By default, log files will be stored in `${jetty.base}/logs`.
|
||||
|
||||
[source, screen, subs="{sub-order}"]
|
||||
....
|
||||
$ java -jar ../start.jar --add-to-start=logging-jul
|
||||
[my-base]$ java -jar ../start.jar --add-to-start=logging-jul
|
||||
|
||||
ALERT: There are enabled module(s) with licenses.
|
||||
The following 1 module(s):
|
||||
|
@ -346,30 +430,43 @@ The following 1 module(s):
|
|||
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Proceed (y/N)? y
|
||||
INFO : slf4j-api transitive, ini template available with --add-to-start=slf4j-api
|
||||
INFO : slf4j-jul transitive
|
||||
INFO : logging-jul initialized in ${jetty.base}/start.d/logging-jul.ini
|
||||
INFO : jul-impl transitively enabled
|
||||
INFO : slf4j-api transitively enabled
|
||||
INFO : slf4j-jul transitively enabled
|
||||
INFO : logging-jul initialized in ${jetty.base}/start.d/logging-jul.ini
|
||||
INFO : resources transitively enabled
|
||||
MKDIR : ${jetty.base}/etc
|
||||
COPY : ${jetty.home}/modules/jul-impl/java-util-logging.properties to ${jetty.base}/etc/java-util-logging.properties
|
||||
MKDIR : ${jetty.base}/logs
|
||||
MKDIR : ${jetty.base}/lib/slf4j
|
||||
DOWNLOAD: http://central.maven.org/maven2/org/slf4j/slf4j-api/1.7.21/slf4j-api-1.7.21.jar to ${jetty.base}/lib/slf4j/slf4j-api-1.7.21.jar
|
||||
DOWNLOAD: http://central.maven.org/maven2/org/slf4j/slf4j-jdk14/1.7.21/slf4j-jdk14-1.7.21.jar to ${jetty.base}/lib/slf4j/slf4j-jdk14-1.7.21.jar
|
||||
INFO : Base directory was modified
|
||||
MKDIR : ${jetty.base}/resources
|
||||
INFO : Base directory was modified
|
||||
|
||||
$ tree
|
||||
[my-base]$ tree
|
||||
.
|
||||
├── etc
|
||||
│ └── java-util-logging.properties
|
||||
├── lib
|
||||
│ └── slf4j
|
||||
│ ├── slf4j-api-1.7.21.jar
|
||||
│ └── slf4j-jdk14-1.7.21.jar
|
||||
├── logs
|
||||
├── resources
|
||||
└── start.d
|
||||
├── logging-jul.ini
|
||||
└── logging-jul.ini
|
||||
....
|
||||
|
||||
[[example-logging-java-commons-logging]]
|
||||
==== Logging with Java Commons Logging
|
||||
Jetty provides support of the Java Commons Logging (jcl) through the `logging-jcl` module, using Slf4j as a bridge.
|
||||
This can be enabled as shown below:
|
||||
Jetty provides support of the Java Commons Logging (jcl) through the `logging-jcl` module, using Slf4j as a binding.
|
||||
This is enabled by activating the `logging-jcl` module.
|
||||
By default, log files will be stored in `${jetty.base}/logs`.
|
||||
|
||||
[source, screen, subs="{sub-order}"]
|
||||
....
|
||||
$ java -jar ../start.jar --add-to-start=logging-jcl
|
||||
[my-base]$ java -jar ../start.jar --add-to-start=logging-jcl
|
||||
|
||||
ALERT: There are enabled module(s) with licenses.
|
||||
The following 2 module(s):
|
||||
|
@ -403,16 +500,18 @@ The following 2 module(s):
|
|||
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Proceed (y/N)? y
|
||||
INFO : slf4j-api transitive, ini template available with --add-to-start=slf4j-api
|
||||
INFO : jcl-impl transitive, ini template available with --add-to-start=jcl-impl
|
||||
INFO : slf4j-jcl transitive
|
||||
INFO : slf4j-api transitively enabled
|
||||
INFO : jcl-impl transitively enabled
|
||||
INFO : resources transitively enabled
|
||||
INFO : slf4j-jcl transitively enabled
|
||||
INFO : logging-jcl initialized in ${jetty.base}/start.d/logging-jcl.ini
|
||||
DOWNLOAD: http://central.maven.org/maven2/org/slf4j/slf4j-api/1.7.21/slf4j-api-1.7.21.jar to ${jetty.base}/lib/slf4j/slf4j-api-1.7.21.jar
|
||||
DOWNLOAD: http://central.maven.org/maven2/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar to ${jetty.base}/lib/jcl/commons-logging-1.1.3.jar
|
||||
MKDIR: ${jetty.base}/logs
|
||||
DOWNLOAD: http://central.maven.org/maven2/org/slf4j/slf4j-jcl/1.7.21/slf4j-jcl-1.7.21.jar to ${jetty.base}/lib/slf4j/slf4j-jcl-1.7.21.jar
|
||||
INFO : Base directory was modified
|
||||
|
||||
$ tree
|
||||
[my-base]$ tree
|
||||
.
|
||||
├── lib
|
||||
│ ├── jcl
|
||||
|
@ -420,6 +519,9 @@ $ tree
|
|||
│ └── slf4j
|
||||
│ ├── slf4j-api-1.7.21.jar
|
||||
│ └── slf4j-jcl-1.7.21.jar
|
||||
├── logs
|
||||
├── resources
|
||||
│ └── commons-logging.properties
|
||||
└── start.d
|
||||
├── logging-jcl.ini
|
||||
└── logging-jcl.ini
|
||||
....
|
||||
|
|
|
@ -23,15 +23,30 @@
|
|||
If you do nothing to configure a separate logging framework, Jetty will default to using an internal `org.eclipse.jetty.util.log.StdErrLog` implementation.
|
||||
This will output all logging events to STDERR (aka `System.err`).
|
||||
|
||||
Simply use Jetty and `StdErrLog` based logging is output.
|
||||
Simply use Jetty and `StdErrLog` based logging is output to the console.
|
||||
|
||||
Included in the Jetty distribution is a logging module that is capable of performing simple capturing of all STDOUT and STDERR output to a file that is rotated daily.
|
||||
Included in the Jetty distribution is a logging module that is capable of performing simple capturing of all STDOUT (`System.out`) and STDERR (`System.err`) output to a file that is rotated daily.
|
||||
|
||||
To enable on this feature via the command line:
|
||||
|
||||
[source, screen, subs="{sub-order}"]
|
||||
....
|
||||
[my-base]$ java -jar /opt/jetty/start.jar --add-to-start=logging-jetty
|
||||
[my-base]$ java -jar ../start.jar --add-to-start=logging-jetty
|
||||
INFO : logging-jetty initialized in ${jetty.base}/start.d/logging-jetty.ini
|
||||
INFO : console-capture transitively enabled, ini template available with --add-to-start=console-capture
|
||||
INFO : resources transitively enabled
|
||||
MKDIR : ${jetty.base}/resources
|
||||
COPY : ${jetty.home}/modules/logging-jetty/jetty-logging.properties to ${jetty.base}/resources/jetty-logging.properties
|
||||
MKDIR : ${jetty.base}/logs
|
||||
INFO : Base directory was modified
|
||||
|
||||
[my-base]$ tree
|
||||
.
|
||||
├── logs
|
||||
├── resources
|
||||
│ └── jetty-logging.properties
|
||||
└── start.d
|
||||
└── logging-jetty.ini
|
||||
....
|
||||
|
||||
The default configuration for logging output will create a file `${jetty.base}/logs/yyyy_mm_dd.stderrout.log` which allows configuration of the output directory by setting the `jetty.logs` property.
|
||||
|
|
|
@ -29,7 +29,6 @@ include::session-configuration-jdbc.adoc[]
|
|||
include::session-configuration-mongodb.adoc[]
|
||||
include::session-configuration-infinispan.adoc[]
|
||||
include::session-configuration-gcloud.adoc[]
|
||||
include::session-configuration-gcloud-module.adoc[]
|
||||
//include::setting-session-characteristics.adoc[]
|
||||
//include::using-persistent-sessions.adoc[]
|
||||
//include::session-clustering-jdbc.adoc[]
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
// ========================================================================
|
||||
// Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd.
|
||||
// ========================================================================
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
//
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
//
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
//
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
|
||||
[source, screen, subs="{sub-order}"]
|
||||
....
|
||||
[mybase]$ java -jar ../start.jar --list-modules=logging,-internal
|
||||
|
||||
Available Modules:
|
||||
==================
|
||||
tags: [logging, -internal]
|
||||
|
||||
Modules for tag 'logging':
|
||||
--------------------------
|
||||
|
||||
Module: console-capture
|
||||
: Redirects JVMs console stderr and stdout to a log file,
|
||||
: including output from Jetty's default StdErrLog logging.
|
||||
Tags: logging
|
||||
LIB: resources/
|
||||
XML: etc/console-capture.xml
|
||||
|
||||
Module: logging-jcl [logging]
|
||||
: Configure jetty logging to use Java Commons Logging (jcl)
|
||||
: SLF4J is used as the core logging mechanism.
|
||||
Tags: logging
|
||||
Depend: jcl-impl, slf4j-jcl
|
||||
JVM: -Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog
|
||||
|
||||
Module: logging-jetty [logging]
|
||||
: Configure jetty logging mechanism.
|
||||
: Provides a ${jetty.base}/resources/jetty-logging.properties.
|
||||
Tags: logging
|
||||
Depend: console-capture, resources
|
||||
|
||||
Module: logging-jul [logging]
|
||||
: Configure jetty logging to use Java Util Logging (jul)
|
||||
: SLF4J is used as the core logging mechanism.
|
||||
Tags: logging
|
||||
Depend: jul-impl, slf4j-jul
|
||||
JVM: -Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog
|
||||
|
||||
Module: logging-log4j [logging]
|
||||
: Configure jetty logging to use Log4j Logging
|
||||
: SLF4J is used as the core logging mechanism.
|
||||
Tags: logging
|
||||
Depend: log4j-impl, slf4j-log4j
|
||||
JVM: -Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog
|
||||
|
||||
Module: logging-log4j2 [logging]
|
||||
: Configure jetty logging to use log4j version 2
|
||||
: SLF4J is used as the core logging mechanism.
|
||||
Tags: logging
|
||||
Depend: slf4j-log4j2, log4j2-impl
|
||||
JVM: -Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog
|
||||
|
||||
Module: logging-logback [logging]
|
||||
: Configure jetty logging to use Logback Logging.
|
||||
: SLF4J is used as the core logging mechanism.
|
||||
Tags: logging
|
||||
Depend: logback-impl, slf4j-logback
|
||||
JVM: -Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog
|
||||
|
||||
Module: logging-slf4j [logging]
|
||||
: Configure jetty logging to use slf4j.
|
||||
: Any slf4j-impl implementation is used
|
||||
Tags: logging
|
||||
Depend: slf4j-api, slf4j-impl
|
||||
JVM: -Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.Slf4jLog
|
||||
|
||||
Modules for tag 'requestlog':
|
||||
-----------------------------
|
||||
|
||||
Module: logback-access [requestlog]
|
||||
: Enables logback request log.
|
||||
Tags: requestlog, logging, logback
|
||||
Depend: server, logback-core, resources
|
||||
LIB: lib/logback/logback-access-${logback.version}.jar
|
||||
XML: etc/jetty-logback-access.xml
|
||||
....
|
File diff suppressed because it is too large
Load Diff
|
@ -17,47 +17,53 @@
|
|||
[[startup-modules]]
|
||||
=== Managing Startup Modules
|
||||
|
||||
Jetty 9.1 a new Module system replacing the previous `start.config` + `OPTIONS` techniques from past Jetty Distributions.
|
||||
|
||||
The standard Jetty Distribution ships with several modules defined in `${jetty.home}/modules/`.
|
||||
These modules allow flexibility for implementations and make configuration a much more plug-and-play set up.
|
||||
|
||||
What a Jetty Startup Module Defines:
|
||||
|
||||
A Module Name::
|
||||
The name of the module is the keyword used by the `--module=<name>` command line argument to activate/enable modules, and also find dependent modules.
|
||||
The filename of the module defines its name (eg: server.mod becomes the module named "server").
|
||||
List of Dependant Modules::
|
||||
All modules can declare that they depend on other modules with the `[depend]` section.
|
||||
The list of dependencies is used to transitively resolve other modules that are deemed to be required based on the modules that you activate.
|
||||
The order of modules defined in the graph of active modules is used to determine various execution order for configuration, such as Jetty IoC XML configurations, and to resolve conflicting property declarations.
|
||||
Of note: there is a special section `[optional]` used to describe structurally dependent modules that are not technically required, but might be of use to your specific configuration.
|
||||
The name of the module is the keyword used by the `--module=<name>` command line argument to activate/enable modules, and also find dependent modules.
|
||||
The filename of the module defines its name (eg: server.mod becomes the module named "server").
|
||||
List of Dependent Modules::
|
||||
All modules can declare that they depend on other modules with the `[depend]` section.
|
||||
The list of dependencies is used to transitively resolve other modules that are deemed to be required based on the modules that you activate.
|
||||
The order of modules defined in the graph of active modules is used to determine various execution order for configuration, such as Jetty IoC XML configurations, and to resolve conflicting property declarations.
|
||||
Of note: there is a special section `[optional]` used to describe structurally dependent modules that are not technically required, but might be of use to your specific configuration.
|
||||
List of Libraries::
|
||||
Module can optionally declare that they have libraries that they need to function properly.
|
||||
The `[lib]` section declares a set of pathnames that follow the link:#base-vs-home-resolution[Jetty Base and Jetty Home path resolution rules].
|
||||
Module can optionally declare that they have libraries that they need to function properly.
|
||||
The `[lib]` section declares a set of pathnames that follow the link:#base-vs-home-resolution[Jetty Base and Jetty Home path resolution rules].
|
||||
List of Jetty IoC XML Configurations::
|
||||
A Module can optionally declare a list of Jetty IoC XML configurations used to wire up the functionality that this module defines.
|
||||
The `[xml]` section declares a set of pathnames that follow the link:#base-vs-home-resolution[Jetty Base and Jetty Home path resolution rules].
|
||||
Ideally, all XML files are parameterized to accept properties to configure the various elements of the standard configuration.
|
||||
Allowing for a simplified configuration of Jetty for the vast majority of deployments.
|
||||
The execution order of the Jetty IoC XML configurations is determined by the graph of active module dependencies resolved via the `[depend]` sections.
|
||||
If the default XML is not sufficient to satisfy your needs, you can override this XML by making your own in the `${jetty.base}/etc/` directory, with the same name.
|
||||
The resolution steps for Jetty Base and Jetty Home will ensure that your copy from `${jetty.base}` will be picked up over the default one in `${jetty.home}`.
|
||||
A Module can optionally declare a list of Jetty IoC XML configurations used to wire up the functionality that this module defines.
|
||||
The `[xml]` section declares a set of pathnames that follow the link:#base-vs-home-resolution[Jetty Base and Jetty Home path resolution rules].
|
||||
Ideally, all XML files are parameterized to accept properties to configure the various elements of the standard configuration.
|
||||
Allowing for a simplified configuration of Jetty for the vast majority of deployments.
|
||||
The execution order of the Jetty IoC XML configurations is determined by the graph of active module dependencies resolved via the `[depend]` sections.
|
||||
If the default XML is not sufficient to satisfy your needs, you can override this XML by making your own in the `${jetty.base}/etc/` directory, with the same name.
|
||||
The resolution steps for Jetty Base and Jetty Home will ensure that your copy from `${jetty.base}` will be picked up over the default one in `${jetty.home}`.
|
||||
List of Module Tags::
|
||||
For ease of sorting, modules can be assigned tags.
|
||||
When using the `--list-modules` command, modules will be groups by the first tag that exists in this section.
|
||||
Modules can also be listed specifically by these tags using `--list-modules=<tag name>` on the command line.
|
||||
Ini Variables::
|
||||
The `[ini]` section is used to add or change server parameters at startup.
|
||||
The `[ini]` section can also include a the path of a file or several files which should be made available to the server only.
|
||||
This is helpful when you want to control what jars are available to deployed webapps.
|
||||
Jetty INI Template::
|
||||
Each module can optionally declare a startup ini template that is used to insert/append/inject sample configuration elements into the `start.ini` or `start.d/*.ini` files when using the `--add-to-start=<name>` command line argument in `start.jar`.
|
||||
Commonly used to present some of the parameterized property options from the Jetty IoC XML configuration files also referenced in the same module.
|
||||
The `[ini-template]` section declares this section of sample configuration.
|
||||
Each module can optionally declare a startup ini template that is used to insert/append/inject sample configuration elements into the `start.ini` or `start.d/*.ini` files when using the `--add-to-start=<name>` command line argument in `start.jar`.
|
||||
Commonly used to present some of the parameterized property options from the Jetty IoC XML configuration files also referenced in the same module.
|
||||
The `[ini-template]` section declares this section of sample configuration.
|
||||
Required Files and Directories::
|
||||
If the activation of a module requires some paths to exist, the `[files]` section defines them.
|
||||
There are 2 modes of operation of the entries in this section.
|
||||
If the activation of a module requires some paths to exist, the `[files]` section defines them.
|
||||
There are 2 modes of operation of the entries in this section.
|
||||
Ensure Directory Exists;;
|
||||
If you add a pathname that ends in `"/"` (slash), such as `"webapps/"`, then that directory will be created if it does not yet exist in `${jetty.base}/<pathname>` (eg: `"webapps/"` will result in `${jetty.base}/webapps/` being created).
|
||||
If you add a pathname that ends in `"/"` (slash), such as `"webapps/"`, then that directory will be created if it does not yet exist in `${jetty.base}/<pathname>` (eg: `"webapps/"` will result in `${jetty.base}/webapps/` being created).
|
||||
Download File;;
|
||||
There is a special syntax to allow you to download a file into a specific location if it doesn't exist yet: `<url>:<pathname>`.
|
||||
Currently, the `<url>` must be a `http://` scheme URL (please link:#bugs[let us know] if you need more schemes supported).
|
||||
The `<pathname>` portion follows the link:#base-vs-home-resolution[Jetty Base and Jetty Home path resolution rules].
|
||||
Example: `http://repo.corp.com/maven/corp-security-policy-1.0.jar:lib/corp-security-policy.jar`
|
||||
This will check for the existence of `lib/corp-security-policy.jar`, and if it doesn't exist, it will download the jar file from
|
||||
`http://repo.corp.com/maven/corp-security-policy-1.0.jar`
|
||||
There is a special syntax to allow you to download a file into a specific location if it doesn't exist yet: `<url>:<pathname>`.
|
||||
Currently, the `<url>` must be a `http://` scheme URL (please link:#bugs[let us know] if you need more schemes supported).
|
||||
The `<pathname>` portion follows the link:#base-vs-home-resolution[Jetty Base and Jetty Home path resolution rules].
|
||||
Example: `http://repo.corp.com/maven/corp-security-policy-1.0.jar:lib/corp-security-policy.jar`
|
||||
This will check for the existence of `lib/corp-security-policy.jar`, and if it doesn't exist, it will download the jar file from `http://repo.corp.com/maven/corp-security-policy-1.0.jar`
|
||||
|
||||
[[enabling-modules]]
|
||||
==== Enabling Modules
|
||||
|
@ -241,11 +247,33 @@ Deleting the ini file associated with module is another option, but may not be p
|
|||
|
||||
To see which modules are __available__, use the `--list-modules` command line argument.
|
||||
This command will also show you which modules are __enabled__.
|
||||
Here's an example:
|
||||
Modules are sorted by the value in the `[tags]` section of the associated `.mod` file.
|
||||
If there are multiple entries in the `[tags]` section, it sorts by the first tag in the list.
|
||||
|
||||
____
|
||||
[NOTE]
|
||||
By default, the `--list-modules` command line argument shows all modules that do not include `internal` in the `[tags]` section of the associated `.mod` file.
|
||||
If you would like to see *all* modules, use `--list-modules=*`
|
||||
____
|
||||
|
||||
Here's an example of the `--list-modules` command:
|
||||
|
||||
include::screen-list-modules.adoc[]
|
||||
|
||||
Since being introduced in Jetty 9.1 the modules provided in the Jetty distribution has expanded greatly.
|
||||
Below is a graphical representation of the standard modules and their dependencies.
|
||||
===== Searching Modules
|
||||
|
||||
image:images/modules-9.3-simplified.png[image,width=768]
|
||||
Since the introduction of the module system, many new modules have been added.
|
||||
As a result, looking at the module list as a whole can be somewhat overwhelming.
|
||||
To narrow down which modules you would like to choose from, you can search by values listed under the `[tags]` section.
|
||||
Note that when you search this way, all modules that include your criteria in it's `[tags]` section, including internal modules, will be shown.
|
||||
To filter out internal modules when searching a specific module tag, simply add `-internal` to the command line.
|
||||
For example, if you wanted to look at only the logging modules (excluding the internal implementation modules), you would use `--list-modules=logging,-internal`.
|
||||
|
||||
include::screen-list-logging-modules.adoc[]
|
||||
|
||||
// Since being introduced in Jetty 9.1 the modules provided in the Jetty distribution has expanded greatly.
|
||||
// Below is a graphical representation of the standard modules and their dependencies.
|
||||
//
|
||||
// TODO - Update modules image for 9.4 / 10?
|
||||
//
|
||||
// image:images/modules-9.3-simplified.png[image,width=768]
|
||||
|
|
|
@ -396,18 +396,30 @@ jetty.sslContext.keyStorePassword::
|
|||
|
||||
To enable two-way authentication, you first need to activate the ssl module as shown in the previous section.
|
||||
|
||||
First you need load the `ssl` module and `https` module.
|
||||
[source%nowrap,ini,linenums]
|
||||
.start.d/ssl.ini
|
||||
.$JETTY_BASE/start.d/ssl.ini
|
||||
----
|
||||
# Module: ssl
|
||||
--module=ssl
|
||||
jetty.secure.port=8443
|
||||
jetty.keystore=etc/keystore
|
||||
jetty.keystore.password=OBF:
|
||||
jetty.keymanager.password=OBF:
|
||||
jetty.truststore=etc/truststore
|
||||
jetty.truststore.password=OBF:
|
||||
|
||||
jetty.ssl.host=0.0.0.0
|
||||
jetty.ssl.port=8583
|
||||
jetty.sslContext.keyStorePath=etc/keystore
|
||||
jetty.sslContext.trustStorePath=etc/keystore
|
||||
jetty.sslContext.keyStorePassword=OBF:
|
||||
jetty.sslContext.keyManagerPassword=OBF:
|
||||
jetty.sslContext.trustStorePassword=OBF:
|
||||
jetty.sslContext.trustStoreType=JKS
|
||||
# enable two way authentication
|
||||
jetty.ssl.needClientAuth=true
|
||||
jetty.sslContext.needClientAuth=true
|
||||
----
|
||||
|
||||
[source%nowrap,ini,linenums]
|
||||
.$JETTY_BASE/start.d/https.ini
|
||||
----
|
||||
# Module: https
|
||||
--module=https
|
||||
----
|
||||
|
||||
[[layout-of-keystore-and-truststore]]
|
||||
|
@ -415,19 +427,47 @@ jetty.ssl.needClientAuth=true
|
|||
|
||||
`keystore` only contains the server's private key and certificate.
|
||||
|
||||
[[img-certificate-chain]]
|
||||
image::images/certificate-chain.png[title="Certificate chain", alt="Certificate chain"]
|
||||
|
||||
[literal]
|
||||
.The structure of KeyStore file
|
||||
....
|
||||
├── PrivateKeyEntry
|
||||
│ ├── PrivateKey
|
||||
│ ├── Certificate chain
|
||||
│ │ ├── Server certificate (end entity)
|
||||
│ │ ├── Intermediary CA certificate
|
||||
│ │ └── Root CA certificate
|
||||
├── TrustedCertEntry
|
||||
│ └── Intermediary CA certificate
|
||||
└── TrustedCertEntry
|
||||
└── Root CA certificate
|
||||
....
|
||||
|
||||
[TIP]
|
||||
====
|
||||
└── PrivateKeyEntry +
|
||||
└── Certificate chain +
|
||||
├── Intermediary CA certificate +
|
||||
└── Root CA certificate +
|
||||
are optional
|
||||
====
|
||||
|
||||
[source%nowrap,plain,linenums]
|
||||
----
|
||||
$ keytool -list -keystore keystore -storetype jks -storepass '' -v
|
||||
$ cd $JETTY_BASE
|
||||
$ keytool -list -keystore etc/keystore -storetype jks -storepass '' -v
|
||||
|
||||
Keystore type: JKS
|
||||
Keystore provider: SUN
|
||||
|
||||
Your keystore contains 1 entry
|
||||
Your keystore contains 3 entries
|
||||
|
||||
Alias name: *.example.com
|
||||
Creation date: Sep 12, 2016
|
||||
Creation date: Sep 20, 2016
|
||||
Entry type: PrivateKeyEntry
|
||||
Certificate chain length: 1
|
||||
Certificate chain length: 3
|
||||
Certificate[1]:
|
||||
Owner: CN=*.example.com, OU=Web Servers, O="Example.com Co.,Ltd.", C=CN
|
||||
Issuer: CN="Example.com Co.,Ltd. ETP CA", OU=CA Center, O="Example.com Co.,Ltd.", C=CN
|
||||
|
@ -477,26 +517,98 @@ KeyIdentifier [
|
|||
]
|
||||
]
|
||||
|
||||
Certificate[2]:
|
||||
Owner: CN="Example.com Co.,Ltd. ETP CA", OU=CA Center, O="Example.com Co.,Ltd.", C=CN
|
||||
Issuer: CN="Example.com Co.,Ltd. Root CA", OU=CA Center, O="Example.com Co.,Ltd.", C=CN
|
||||
Serial number: f6e7b86f6fdb467f9498fb599310198f
|
||||
Valid from: Wed Nov 18 00:00:00 CST 2015 until: Sun Nov 18 00:00:00 CST 2035
|
||||
Certificate fingerprints:
|
||||
MD5: ED:A3:91:57:D8:B8:6E:B1:01:58:55:5C:33:14:F5:99
|
||||
SHA1: D9:A4:93:9D:A6:F8:A3:F9:FD:85:51:E2:C5:2E:0B:EE:80:E7:D0:22
|
||||
SHA256: BF:54:7A:F6:CA:0C:FA:EF:93:B6:6B:6E:2E:D7:44:A8:40:00:EC:69:3A:2C:CC:9A:F7:FE:8E:6F:C0:FA:22:38
|
||||
Signature algorithm name: SHA256withRSA
|
||||
Version: 3
|
||||
|
||||
Extensions:
|
||||
|
||||
#1: ObjectId: 2.5.29.35 Criticality=false
|
||||
AuthorityKeyIdentifier [
|
||||
KeyIdentifier [
|
||||
0000: A6 BD 5F B3 E8 7D 74 3D 20 44 66 1A 16 3B 1B DF .._...t= Df..;..
|
||||
0010: E6 E6 04 46 ...F
|
||||
]
|
||||
]
|
||||
|
||||
#2: ObjectId: 2.5.29.19 Criticality=true
|
||||
BasicConstraints:[
|
||||
CA:true
|
||||
PathLen:2147483647
|
||||
]
|
||||
|
||||
#3: ObjectId: 2.5.29.15 Criticality=true
|
||||
KeyUsage [
|
||||
Key_CertSign
|
||||
Crl_Sign
|
||||
]
|
||||
|
||||
#4: ObjectId: 2.5.29.14 Criticality=false
|
||||
SubjectKeyIdentifier [
|
||||
KeyIdentifier [
|
||||
0000: 44 9B AD 31 E7 FE CA D5 5A 8E 17 55 F9 F0 1D 6B D..1....Z..U...k
|
||||
0010: F5 A5 8F C1 ....
|
||||
]
|
||||
]
|
||||
|
||||
Certificate[3]:
|
||||
Owner: CN="Example.com Co.,Ltd. Root CA", OU=CA Center, O="Example.com Co.,Ltd.", C=CN
|
||||
Issuer: CN="Example.com Co.,Ltd. Root CA", OU=CA Center, O="Example.com Co.,Ltd.", C=CN
|
||||
Serial number: f0a45bc9972c458cbeae3f723055f1ac
|
||||
Valid from: Wed Nov 18 00:00:00 CST 2015 until: Sun Nov 18 00:00:00 CST 2114
|
||||
Certificate fingerprints:
|
||||
MD5: 50:61:62:22:71:60:F7:69:2E:27:42:6B:62:31:82:79
|
||||
SHA1: 7A:6D:A6:48:B1:43:03:3B:EA:A0:29:2F:19:65:9C:9B:0E:B1:03:1A
|
||||
SHA256: 05:3B:9C:5B:8E:18:61:61:D1:9C:AA:0E:8C:B1:EA:44:C2:6E:67:5D:96:30:EC:8C:F6:6F:E1:EC:AD:00:60:F1
|
||||
Signature algorithm name: SHA256withRSA
|
||||
Version: 3
|
||||
|
||||
Extensions:
|
||||
|
||||
#1: ObjectId: 2.5.29.35 Criticality=false
|
||||
AuthorityKeyIdentifier [
|
||||
KeyIdentifier [
|
||||
0000: A6 BD 5F B3 E8 7D 74 3D 20 44 66 1A 16 3B 1B DF .._...t= Df..;..
|
||||
0010: E6 E6 04 46 ...F
|
||||
]
|
||||
]
|
||||
|
||||
#2: ObjectId: 2.5.29.19 Criticality=true
|
||||
BasicConstraints:[
|
||||
CA:true
|
||||
PathLen:2147483647
|
||||
]
|
||||
|
||||
#3: ObjectId: 2.5.29.15 Criticality=true
|
||||
KeyUsage [
|
||||
Key_CertSign
|
||||
Crl_Sign
|
||||
]
|
||||
|
||||
#4: ObjectId: 2.5.29.14 Criticality=false
|
||||
SubjectKeyIdentifier [
|
||||
KeyIdentifier [
|
||||
0000: A6 BD 5F B3 E8 7D 74 3D 20 44 66 1A 16 3B 1B DF .._...t= Df..;..
|
||||
0010: E6 E6 04 46 ...F
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
|
||||
*******************************************
|
||||
*******************************************
|
||||
|
||||
----
|
||||
|
||||
`truststore` contains intermediary CA and root CA.
|
||||
|
||||
[source%nowrap,plain,linenums]
|
||||
----
|
||||
$ keytool -list -keystore truststore -storetype jks -storepass '' -v
|
||||
|
||||
Keystore type: JKS
|
||||
Keystore provider: SUN
|
||||
|
||||
Your keystore contains 2 entries
|
||||
|
||||
Alias name: example.com co.,ltd. etp ca
|
||||
Creation date: Sep 12, 2016
|
||||
Creation date: Sep 20, 2016
|
||||
Entry type: trustedCertEntry
|
||||
|
||||
Owner: CN="Example.com Co.,Ltd. ETP CA", OU=CA Center, O="Example.com Co.,Ltd.", C=CN
|
||||
|
@ -547,7 +659,7 @@ KeyIdentifier [
|
|||
|
||||
|
||||
Alias name: example.com co.,ltd. root ca
|
||||
Creation date: Sep 12, 2016
|
||||
Creation date: Sep 20, 2016
|
||||
Entry type: trustedCertEntry
|
||||
|
||||
Owner: CN="Example.com Co.,Ltd. Root CA", OU=CA Center, O="Example.com Co.,Ltd.", C=CN
|
||||
|
@ -597,10 +709,27 @@ KeyIdentifier [
|
|||
*******************************************
|
||||
----
|
||||
|
||||
____
|
||||
[NOTE]
|
||||
If you use a keystore which contains only one `PrivateKeyEntry` item as the `keystore` and the `truststore`, you may get a `javax.net.ssl.SSLHandshakeException` with `null cert chain` message.
|
||||
____
|
||||
In addition, you can split `$JETTY/etc/keystore` as two files.
|
||||
One is `$JETTY/etc/keystore` which only contains the server’s private key and certificate,
|
||||
the other is `$JETTY/etc/truststore` which contains intermediary CA and root CA.
|
||||
|
||||
[literal]
|
||||
.The structure of `$JETTY/etc/keystore`
|
||||
....
|
||||
└── PrivateKeyEntry
|
||||
├── PrivateKey
|
||||
└── Certificate chain
|
||||
└── Server certificate (end entity)
|
||||
....
|
||||
|
||||
[literal]
|
||||
.The structure of `$JETTY/etc/truststore`
|
||||
....
|
||||
├── TrustedCertEntry
|
||||
│ └── Intermediary CA certificate
|
||||
└── TrustedCertEntry
|
||||
└── Root CA certificate
|
||||
....
|
||||
|
||||
[[configuring-sslcontextfactory]]
|
||||
==== Configuring the Jetty SslContextFactory
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 5.9 KiB |
|
@ -181,20 +181,22 @@ public class LdapLoginModule extends AbstractLoginModule
|
|||
|
||||
public class LDAPUserInfo extends UserInfo
|
||||
{
|
||||
|
||||
Attributes attributes;
|
||||
|
||||
/**
|
||||
* @param userName
|
||||
* @param credential
|
||||
*/
|
||||
public LDAPUserInfo(String userName, Credential credential)
|
||||
public LDAPUserInfo(String userName, Credential credential, Attributes attributes)
|
||||
{
|
||||
super(userName, credential);
|
||||
this.attributes = attributes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> doFetchRoles() throws Exception
|
||||
{
|
||||
return getUserRoles(_rootContext, getUserName());
|
||||
return getUserRoles(_rootContext, getUserName(), attributes);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -214,7 +216,8 @@ public class LdapLoginModule extends AbstractLoginModule
|
|||
*/
|
||||
public UserInfo getUserInfo(String username) throws Exception
|
||||
{
|
||||
String pwdCredential = getUserCredentials(username);
|
||||
Attributes attributes = getUserAttributes(username);
|
||||
String pwdCredential = getUserCredentials(attributes);
|
||||
|
||||
if (pwdCredential == null)
|
||||
{
|
||||
|
@ -223,7 +226,7 @@ public class LdapLoginModule extends AbstractLoginModule
|
|||
|
||||
pwdCredential = convertCredentialLdapToJetty(pwdCredential);
|
||||
Credential credential = Credential.getCredential(pwdCredential);
|
||||
return new LDAPUserInfo(username, credential);
|
||||
return new LDAPUserInfo(username, credential, attributes);
|
||||
}
|
||||
|
||||
protected String doRFC2254Encoding(String inputString)
|
||||
|
@ -258,7 +261,7 @@ public class LdapLoginModule extends AbstractLoginModule
|
|||
}
|
||||
|
||||
/**
|
||||
* attempts to get the users credentials from the users context
|
||||
* attempts to get the users LDAP attributes from the users context
|
||||
* <p>
|
||||
* NOTE: this is not an user authenticated operation
|
||||
*
|
||||
|
@ -266,53 +269,39 @@ public class LdapLoginModule extends AbstractLoginModule
|
|||
* @return
|
||||
* @throws LoginException
|
||||
*/
|
||||
private String getUserCredentials(String username) throws LoginException
|
||||
private Attributes getUserAttributes(String username) throws LoginException
|
||||
{
|
||||
String ldapCredential = null;
|
||||
Attributes attributes = null;
|
||||
|
||||
SearchControls ctls = new SearchControls();
|
||||
ctls.setCountLimit(1);
|
||||
ctls.setDerefLinkFlag(true);
|
||||
ctls.setSearchScope(SearchControls.SUBTREE_SCOPE);
|
||||
|
||||
String filter = "(&(objectClass={0})({1}={2}))";
|
||||
|
||||
LOG.debug("Searching for users with filter: \'" + filter + "\'" + " from base dn: " + _userBaseDn);
|
||||
|
||||
try
|
||||
{
|
||||
Object[] filterArguments = {_userObjectClass, _userIdAttribute, username};
|
||||
NamingEnumeration<SearchResult> results = _rootContext.search(_userBaseDn, filter, filterArguments, ctls);
|
||||
|
||||
LOG.debug("Found user?: " + results.hasMoreElements());
|
||||
|
||||
if (!results.hasMoreElements())
|
||||
{
|
||||
throw new LoginException("User not found.");
|
||||
}
|
||||
|
||||
SearchResult result = findUser(username);
|
||||
|
||||
Attributes attributes = result.getAttributes();
|
||||
|
||||
Attribute attribute = attributes.get(_userPasswordAttribute);
|
||||
if (attribute != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
byte[] value = (byte[]) attribute.get();
|
||||
|
||||
ldapCredential = new String(value);
|
||||
}
|
||||
catch (NamingException e)
|
||||
{
|
||||
LOG.debug("no password available under attribute: " + _userPasswordAttribute);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (NamingException e)
|
||||
{
|
||||
SearchResult result;
|
||||
try {
|
||||
result = findUser(username);
|
||||
attributes = result.getAttributes();
|
||||
}
|
||||
catch (NamingException e) {
|
||||
throw new LoginException("Root context binding failure.");
|
||||
}
|
||||
|
||||
return attributes;
|
||||
}
|
||||
|
||||
private String getUserCredentials(Attributes attributes) throws LoginException
|
||||
{
|
||||
String ldapCredential = null;
|
||||
|
||||
Attribute attribute = attributes.get(_userPasswordAttribute);
|
||||
if (attribute != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
byte[] value = (byte[]) attribute.get();
|
||||
|
||||
ldapCredential = new String(value);
|
||||
}
|
||||
catch (NamingException e)
|
||||
{
|
||||
LOG.debug("no password available under attribute: " + _userPasswordAttribute);
|
||||
}
|
||||
}
|
||||
|
||||
LOG.debug("user cred is: " + ldapCredential);
|
||||
|
@ -330,9 +319,22 @@ public class LdapLoginModule extends AbstractLoginModule
|
|||
* @return
|
||||
* @throws LoginException
|
||||
*/
|
||||
private List<String> getUserRoles(DirContext dirContext, String username) throws LoginException, NamingException
|
||||
private List<String> getUserRoles(DirContext dirContext, String username, Attributes attributes) throws LoginException, NamingException
|
||||
{
|
||||
String userDn = _userRdnAttribute + "=" + username + "," + _userBaseDn;
|
||||
String rdnValue = username;
|
||||
Attribute attribute = attributes.get(_userRdnAttribute);
|
||||
if (attribute != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
rdnValue = (String) attribute.get(); // switch to the value stored in the _userRdnAttribute if we can
|
||||
}
|
||||
catch (NamingException e)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
String userDn = _userRdnAttribute + "=" + rdnValue + "," + _userBaseDn;
|
||||
|
||||
return getUserRolesByDn(dirContext, userDn);
|
||||
}
|
||||
|
@ -537,7 +539,7 @@ public class LdapLoginModule extends AbstractLoginModule
|
|||
String filter = "(&(objectClass={0})({1}={2}))";
|
||||
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Searching for users with filter: \'" + filter + "\'" + " from base dn: " + _userBaseDn);
|
||||
LOG.debug("Searching for user " + username + " with filter: \'" + filter + "\'" + " from base dn: " + _userBaseDn);
|
||||
|
||||
Object[] filterArguments = new Object[]{
|
||||
_userObjectClass,
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.io.FileInputStream;
|
|||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
@ -308,7 +309,7 @@ public class Modules implements Iterable<Module>
|
|||
if (p.isTransitive() && !transitive)
|
||||
p.clearTransitiveEnable();
|
||||
else
|
||||
throw new UsageException("%s provides %s, which is already provided by %s enabled in %s",module.getName(),name,p.getName(),p.getEnableSources());
|
||||
throw new UsageException("Module %s provides %s, which is already provided by %s enabled in %s",module.getName(),name,p.getName(),p.getEnableSources());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -337,11 +338,12 @@ public class Modules implements Iterable<Module>
|
|||
for(String dependsOn:module.getDepends())
|
||||
{
|
||||
// Look for modules that provide that dependency
|
||||
Set<Module> providers = _provided.get(dependsOn);
|
||||
StartLog.debug("%s depends on %s provided by ",module,dependsOn,providers);
|
||||
Set<Module> providers = getAvailableProviders(dependsOn);
|
||||
|
||||
StartLog.debug("Module %s depends on %s provided by ",module,dependsOn,providers);
|
||||
|
||||
// If there are no known providers of the module
|
||||
if ((providers==null||providers.isEmpty()))
|
||||
if (providers.isEmpty())
|
||||
{
|
||||
// look for a dynamic module
|
||||
if (dependsOn.contains("/"))
|
||||
|
@ -359,13 +361,15 @@ public class Modules implements Iterable<Module>
|
|||
}
|
||||
|
||||
// If a provider is already enabled, then add a transitive enable
|
||||
long enabled=providers.stream().filter(Module::isEnabled).count();
|
||||
if (enabled>0)
|
||||
if (providers.stream().filter(Module::isEnabled).count()!=0)
|
||||
providers.stream().filter(m->m.isEnabled()&&m!=module).forEach(m->enable(newlyEnabled,m,"transitive provider of "+dependsOn+" for "+module.getName(),true));
|
||||
else
|
||||
{
|
||||
// Is there an obvious default?
|
||||
Optional<Module> dftProvider = providers.stream().filter(m->m.getName().equals(dependsOn)).findFirst();
|
||||
Optional<Module> dftProvider = (providers.size()==1)
|
||||
?providers.stream().findFirst()
|
||||
:providers.stream().filter(m->m.getName().equals(dependsOn)).findFirst();
|
||||
|
||||
if (dftProvider.isPresent())
|
||||
enable(newlyEnabled,dftProvider.get(),"transitive provider of "+dependsOn+" for "+module.getName(),true);
|
||||
else if (StartLog.isDebugEnabled())
|
||||
|
@ -374,6 +378,47 @@ public class Modules implements Iterable<Module>
|
|||
}
|
||||
}
|
||||
|
||||
private Set<Module> getAvailableProviders(String name)
|
||||
{
|
||||
// Get all available providers
|
||||
|
||||
Set<Module> providers = _provided.get(name);
|
||||
if (providers==null || providers.isEmpty())
|
||||
return Collections.emptySet();
|
||||
|
||||
providers = new HashSet<>(providers);
|
||||
|
||||
// find all currently provided names by other modules
|
||||
Set<String> provided = new HashSet<>();
|
||||
for (Module m : _modules)
|
||||
{
|
||||
if (m.isEnabled())
|
||||
{
|
||||
provided.add(m.getName());
|
||||
provided.addAll(m.getProvides());
|
||||
}
|
||||
}
|
||||
|
||||
// Remove any that cannot be selected
|
||||
for (Iterator<Module> i = providers.iterator(); i.hasNext();)
|
||||
{
|
||||
Module provider = i.next();
|
||||
if (!provider.isEnabled())
|
||||
{
|
||||
for (String p : provider.getProvides())
|
||||
{
|
||||
if (provided.contains(p))
|
||||
{
|
||||
i.remove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return providers;
|
||||
}
|
||||
|
||||
public Module get(String name)
|
||||
{
|
||||
Module module = _names.get(name);
|
||||
|
@ -381,7 +426,7 @@ public class Modules implements Iterable<Module>
|
|||
{
|
||||
String reason = _deprecated.getProperty(name);
|
||||
if (reason!=null)
|
||||
StartLog.warn("Module '%s' is no longer available: %s",name,reason);
|
||||
StartLog.warn("Module %s is no longer available: %s",name,reason);
|
||||
}
|
||||
return module;
|
||||
}
|
||||
|
@ -405,13 +450,13 @@ public class Modules implements Iterable<Module>
|
|||
// Check dependencies
|
||||
m.getDepends().forEach(d->
|
||||
{
|
||||
Set<Module> providers =_provided.get(d);
|
||||
Set<Module> providers = getAvailableProviders(d);
|
||||
if (providers.stream().filter(Module::isEnabled).count()==0)
|
||||
{
|
||||
if (unsatisfied.length()>0)
|
||||
unsatisfied.append(',');
|
||||
unsatisfied.append(m.getName());
|
||||
StartLog.error("Module %s requires a `%s` module from one of %s%n",m.getName(),d,providers);
|
||||
StartLog.error("Module %s requires a module providing %s from one of %s%n",m.getName(),d,providers);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -14,6 +14,7 @@ slf4j-impl
|
|||
[provides]
|
||||
jcl-api
|
||||
jcl-impl
|
||||
slf4j+jcl
|
||||
|
||||
[files]
|
||||
maven://org.slf4j/jcl-over-slf4j/${slf4j.version}|lib/slf4j/jcl-over-slf4j-${slf4j.version}.jar
|
||||
|
|
|
@ -14,7 +14,7 @@ handlers = java.util.logging.FileHandler
|
|||
############################################################
|
||||
|
||||
# default file output is in user's home directory.
|
||||
java.util.logging.FileHandler.pattern = logs/jetty%u.log
|
||||
java.util.logging.FileHandler.pattern = ${jetty.logging.dir}/jetty%u.log
|
||||
java.util.logging.FileHandler.limit = 50000
|
||||
java.util.logging.FileHandler.count = 1
|
||||
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
|
||||
|
|
|
@ -12,6 +12,7 @@ slf4j-impl
|
|||
|
||||
[provides]
|
||||
jul-impl
|
||||
slf4j+jul
|
||||
|
||||
[files]
|
||||
maven://org.slf4j/jul-to-slf4j/${slf4j.version}|lib/slf4j/jul-to-slf4j-${slf4j.version}.jar
|
||||
|
|
|
@ -15,7 +15,7 @@ log4j-api
|
|||
log4j-impl
|
||||
|
||||
[files]
|
||||
basehome:modules/log4j/log4j.properties|resources/log4j.properties
|
||||
basehome:modules/log4j/log4j.xml|resources/log4j.xml
|
||||
maven://log4j/log4j/${log4j.version}|lib/log4j/log4j-${log4j.version}.jar
|
||||
logs/
|
||||
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
[description]
|
||||
Provides a Log4j v1.2 binding to Log4j v2 logging.
|
||||
|
||||
[tags]
|
||||
logging
|
||||
log4j2
|
||||
log4j
|
||||
internal
|
||||
|
||||
[depends]
|
||||
log4j2-api
|
||||
log4j2-impl
|
||||
|
||||
[provides]
|
||||
log4j-api
|
||||
log4j-impl
|
||||
|
||||
[files]
|
||||
maven://org.apache.logging.log4j/log4j-1.2-api/${log4j2.version}|lib/log4j/log4j-1.2-api-${log4j2.version}.jar
|
||||
|
||||
[lib]
|
||||
lib/log4j/log4j-1.2-api-${log4j2.version}.jar
|
|
@ -1,18 +0,0 @@
|
|||
|
||||
log4j.rootLogger=INFO, file
|
||||
#log4j.rootLogger=INFO, stderr
|
||||
|
||||
log4j.appender.stderr.Target=System.err
|
||||
log4j.appender.stderr=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stderr.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stderr.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
|
||||
|
||||
# Direct log messages to a log file
|
||||
log4j.appender.file=org.apache.log4j.RollingFileAppender
|
||||
log4j.appender.file.File=${jetty.base}/logs/jetty.log
|
||||
log4j.appender.file.MaxFileSize=10MB
|
||||
log4j.appender.file.MaxBackupIndex=10
|
||||
log4j.appender.file.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
||||
|
||||
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
|
||||
<appender name="RollingFile" class="org.apache.log4j.RollingFileAppender">
|
||||
<param name="File" value="${jetty.logging.dir}/jetty.log" />
|
||||
<param name="MaxFileSize" value="100MB" />
|
||||
<param name="MaxBackupIndex" value="10" />
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n"/>
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<root>
|
||||
<priority value ="info" />
|
||||
<appender-ref ref="RollingFile" />
|
||||
</root>
|
||||
</log4j:configuration>
|
|
@ -1,15 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration status="warn" name="Jetty" >
|
||||
<Appenders>
|
||||
<RollingFile name="RollingFile" fileName="logs/jetty.log" filePattern="logs/jetty-%d{MM-dd-yyyy}.log.gz" ignoreExceptions="false">
|
||||
<RollingFile name="RollingFile"
|
||||
fileName="${jetty.logging.dir}/jetty.log"
|
||||
filePattern="${jetty.logging.dir}/jetty-%d{MM-dd-yyyy}.log.gz"
|
||||
ignoreExceptions="false">
|
||||
<PatternLayout>
|
||||
<Pattern>%d %p %c{1.} [%t] %m%n</Pattern>
|
||||
<Pattern>%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n</Pattern>
|
||||
</PatternLayout>
|
||||
<TimeBasedTriggeringPolicy />
|
||||
<SizeBasedTriggeringPolicy size="10MB"/>
|
||||
<DefaultRolloverStrategy max="10"/>
|
||||
</RollingFile>
|
||||
<Console name="Console" target="SYSTEM_ERR">
|
||||
<PatternLayout pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n"/>
|
||||
</Console>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Root level="info">
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator"/>
|
||||
|
||||
<appender name="ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>logs/jetty.log</file>
|
||||
<file>${jetty.logging.dir}/jetty.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!-- rollover daily -->
|
||||
<fileNamePattern>logs/jetty-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||
<maxFileSize>10MB</maxFileSize>
|
||||
<maxHistory>5</maxHistory>
|
||||
<maxFileSize>100MB</maxFileSize>
|
||||
<maxHistory>10</maxHistory>
|
||||
<totalSizeCap>2GB</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
|
@ -15,15 +15,8 @@
|
|||
</encoder>
|
||||
</appender>
|
||||
|
||||
<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>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="ROLLING" />
|
||||
</root>
|
||||
|
||||
</configuration>
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ jcl-impl
|
|||
|
||||
[provides]
|
||||
slf4j-impl
|
||||
slf4j+jcl
|
||||
|
||||
[files]
|
||||
maven://org.slf4j/slf4j-jcl/${slf4j.version}|lib/slf4j/slf4j-jcl-${slf4j.version}.jar
|
||||
|
|
|
@ -11,6 +11,7 @@ slf4j-api
|
|||
|
||||
[provides]
|
||||
slf4j-impl
|
||||
slf4j+jul
|
||||
|
||||
[files]
|
||||
maven://org.slf4j/slf4j-jdk14/${slf4j.version}|lib/slf4j/slf4j-jdk14-${slf4j.version}.jar
|
||||
|
|
Loading…
Reference in New Issue