//
//  ========================================================================
//  Copyright (c) 1995-2020 Mort Bay Consulting Pty Ltd and others.
//  ========================================================================
//  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.
//  ========================================================================
//

[[configuring-logging-modules]]
=== 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.
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}"]
....
[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       transitively enabled
MKDIR : ${jetty.base}/resources
COPY  : ${jetty.home}/modules/logging-jetty/resources/jetty-logging.properties to ${jetty.base}/resources/jetty-logging.properties
INFO  : Base directory was modified
....

As noted above, Jetty supports a wide array of logging technologies.
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 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.

[source, screen, subs="{sub-order}"]
....
[my-base]$ java -jar ../start.jar --add-to-start=logging-slf4j

ALERT: There are enabled module(s) with licenses.
The following 1 module(s):
 + contains software not provided by the Eclipse Foundation!
 + contains software not covered by the Eclipse Public License!
 + has not been audited for compliance with its license

 Module: slf4j-api
  + 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.

Proceed (y/N)? y
INFO  : slf4j-api       transitively enabled
INFO  : logging-slf4j   initialized in ${jetty.base}/start.d/logging-slf4j.ini
MKDIR : ${jetty.base}/lib/slf4j
DOWNLD: https://repo1.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
INFO  : Base directory was modified
ERROR : Module logging-slf4j requires a module providing slf4j-impl from one of [slf4j-simple-impl, slf4j-logback, slf4j-jul, slf4j-log4j2, slf4j-log4j]

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
DOWNLD: https://repo1.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-simple-impl/resources/simplelogger.properties to ${jetty.base}/resources/simplelogger.properties
INFO  : Base directory was modified

[my-base]$ tree
.
├── lib
│   └── slf4j
│       ├── slf4j-api-1.7.21.jar
│       └── slf4j-simple-1.7.21.jar
├── resources
│   └── simplelogger.properties
└── start.d
    ├── logging-slf4j.ini
    └── slf4j-simple-impl.ini
....

Jetty is now configured to log using the SLF4J framework.
A standard SLF4J properties file is located in `${jetty.base}/resources/simplelogger.properties`.

[[example-logging-log4j]]
==== 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.

[source, screen, subs="{sub-order}"]
....
[my-base]$ java -jar ../start.jar --add-to-start=logging-log4j

ALERT: There are enabled module(s) with licenses.
The following 2 module(s):
 + contains software not provided by the Eclipse Foundation!
 + contains software not covered by the Eclipse Public License!
 + has not been audited for compliance with its license

 Module: log4j-impl
  + Log4j is released under the Apache 2.0 license.
  + http://www.apache.org/licenses/LICENSE-2.0.html

 Module: slf4j-api
  + 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.

Proceed (y/N)? y
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
DOWNLD: https://repo1.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
COPY  : /Users/admin/.m2/repository/log4j/log4j/1.2.17/log4j-1.2.17.jar to ${jetty.base}/lib/log4j/log4j-1.2.17.jar
MKDIR : ${jetty.base}/resources
COPY  : ${jetty.home}/modules/log4j-impl/resources/log4j.xml to ${jetty.base}/resources/log4j.xml
DOWNLD: https://repo1.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

[my-base]$ tree
.
├── lib
│   ├── log4j
│   │   └── log4j-1.2.17.jar
│   └── slf4j
│       ├── slf4j-api-1.7.21.jar
│       └── slf4j-log4j12-1.7.21.jar
├── resources
│   └── log4j.xml
└── start.d
    └── logging-log4j.ini
....

Jetty is now configured to log using the Log4j framework.
A standard Log4j configuration file is located in `${jetty.base}/resources/log4j.xml`.

Or, to set up Log4j2, enable the `logging-log4j2` module.

[source, screen, subs="{sub-order}"]
....
[my-base]$ java -jar ../start.jar --add-to-start=logging-log4j2

ALERT: There are enabled module(s) with licenses.
The following 2 module(s):
 + contains software not provided by the Eclipse Foundation!
 + contains software not covered by the Eclipse Public License!
 + has not been audited for compliance with its license

 Module: log4j2-api
  + Log4j is released under the Apache 2.0 license.
  + http://www.apache.org/licenses/LICENSE-2.0.html

 Module: slf4j-api
  + 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.

Proceed (y/N)? y
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
DOWNLD: https://repo1.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/log4j2
DOWNLD: https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-api/2.6.1/log4j-api-2.6.1.jar to ${jetty.base}/lib/log4j2/log4j-api-2.6.1.jar
MKDIR : ${jetty.base}/resources
DOWNLD: https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-slf4j-impl/2.6.1/log4j-slf4j-impl-2.6.1.jar to ${jetty.base}/lib/log4j2/log4j-slf4j-impl-2.6.1.jar
DOWNLD: https://repo1.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-impl/resources/log4j2.xml to ${jetty.base}/resources/log4j2.xml
INFO  : Base directory was modified

[my-base]$ tree
.
├── lib
│   ├── log4j2
│   │   ├── log4j-api-2.6.1.jar
│   │   ├── log4j-core-2.6.1.jar
│   │   └── log4j-slf4j-impl-2.6.1.jar
│   └── slf4j
│       └── slf4j-api-1.7.21.jar
├── resources
│   └── log4j2.xml
└── start.d
    └── logging-log4j2.ini
....

At this point Jetty is configured so that the Jetty server itself will log using Log4j2, using the Log4j2 configuration found in `{$jetty.base}/resources/log4j2.xml`.

[[example-logging-logback]]
==== Logging with Logback

It is possible to have the Jetty Server logging configured so that Logback controls the output of logging events produced by Jetty.
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.

[source, screen, subs="{sub-order}"]
....
[my-base]$ java -jar ../start.jar --add-to-start=logging-logback

ALERT: There are enabled module(s) with licenses.
The following 2 module(s):
 + contains software not provided by the Eclipse Foundation!
 + contains software not covered by the Eclipse Public License!
 + has not been audited for compliance with its license

 Module: logback-impl
  + 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

 Module: slf4j-api
  + 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.

Proceed (y/N)? y
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
DOWNLD: https://repo1.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
DOWNLD: https://repo1.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-impl/resources/logback.xml to ${jetty.base}/resources/logback.xml
DOWNLD: https://repo1.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

[my-base]$ tree
.
├── lib
│   ├── logback
│   │   ├── logback-classic-1.1.7.jar
│   │   └── logback-core-1.1.7.jar
│   └── slf4j
│       └── slf4j-api-1.7.21.jar
├── resources
│   └── logback.xml
└── start.d
    └── 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`.

==== Logging with Java Util Logging

[[example-logging-java-util-logging]]
===== Java Util Logging with SLF4J
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] as a binding layer.

[source, screen, subs="{sub-order}"]
....
[my-base]$ java -jar ../start.jar --add-to-start=logging-jul

ALERT: There are enabled module(s) with licenses.
The following 1 module(s):
 + contains software not provided by the Eclipse Foundation!
 + contains software not covered by the Eclipse Public License!
 + has not been audited for compliance with its license

 Module: slf4j-api
  + 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.

Proceed (y/N)? y
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/etc/java-util-logging.properties to ${jetty.base}/etc/java-util-logging.properties
MKDIR : ${jetty.base}/lib/slf4j
DOWNLD: https://repo1.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
DOWNLD: https://repo1.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

[my-base]$ tree
.
├── etc
│   └── java-util-logging.properties
├── lib
│   └── slf4j
│       ├── slf4j-api-1.7.21.jar
│       └── slf4j-jdk14-1.7.21.jar
└── start.d
    └── logging-jul.ini
....

Jetty is now configured to log using the JUL framework.
A standard JUL properties file is located in `${jetty.base}/etc/java-util-logging.properties`.

==== Capturing Console Output

By default, enabling the above modules will output log information to the console.
Included in the distribution is the `console-capture` module, which can be used in lieu of additional configuration to the selected logging module to capture this output to a `logs` directory in your `${jetty.base}`.
To enable this functionality, activate the `console-capture` module.

[source, screen, subs="{sub-order}"]
....
[my-base]$ java -jar ../start.jar --add-to-start=console-capture
INFO  : console-capture initialized in ${jetty.base}/start.d/console-capture.ini
MKDIR : ${jetty.base}/logs
INFO  : Base directory was modified

[my-base]$ tree
.
├── logs
└── start.d
    └── console-capture.ini
....

As an example, here is the output from Logback before using the `console-capture` module:

[source, screen, subs="{sub-order}"]
....
[my-base]$ java -jar ../start.jar
419  [main] INFO  org.eclipse.jetty.util.log - Logging initialized @508ms to org.eclipse.jetty.util.log.Slf4jLog
540  [main] INFO  org.eclipse.jetty.server.Server - jetty-9.4.0-SNAPSHOT
575  [main] INFO  o.e.jetty.server.AbstractConnector - Started ServerConnector@3c0ecd4b{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
575  [main] INFO  org.eclipse.jetty.server.Server - Started @668ms
....

After enabling `console-capture`, the output is as follows, which displays the location the log is being saved to:

[source, screen, subs="{sub-order}"]
....
[my-base]$ java -jar ../start.jar
151  [main] INFO  org.eclipse.jetty.util.log - Logging initialized @238ms to org.eclipse.jetty.util.log.Slf4jLog
196  [main] INFO  org.eclipse.jetty.util.log - Console stderr/stdout captured to /installs/jetty-distribution/mybase/logs/2016_10_21.jetty.log
....
