You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 12, 2024. It is now read-only.
* Issue #68 added request context scope
* Issue #68 added request context scope
* Issue #68 added skeleton Logging Handler
* Issue #68 work in progress
* Issue #68 work in progress
* working implementation using a threadlocal to stop looping
* Issue #68 update to latest google-cloud-java LoggingHandler
* Issue #68
Updated to latest gcloud API
removed copied LoggingHandlers
removed instanceid from monitored resource
* Issue #68 Use same labels as nginx
* Issue #68
Code cleanups after review
* Issue #68
Removed stackdriver logging, so this just configures JUL to capture the traceid and log to stderr
* renamed traceid to traceId
* gcloud api not currently used
* Tunnel traceId in parameters #68
* Simplified with traceId lookup in formatter #68
* Use 8.2 beta stackdriver
* Improved formatting
* use logger name rather than source
* run jetty from the webapp working directory so logging configuration may be relative
* Testing logging
Test googleapis/google-cloud-java#1535 and jetty-9.4.1-SNAPSHOT
* use released 9.4.1
* Issue #68
minor clean ups
* Do not CD to non existant directory
* improved README
* fixed Cloud SDK
* Released beta of google-cloud-logging
* updated google-cloud API to 0.8.3-beta
* added remote test to check logging
* Stackdriver logging testing
improved comments
check for traceid
* upgrade to 0.9.2
* Test for zone
* upgrade to 10.0 gcloud API
* enable gae module only of GAE_INSTANCE environment variable is set
* improved gae.mod documentation
* GCP module
Rename gae module and configuration to gcp
Split the jetty.commands into jetty.commands and gcp.commands
moved commands file to jetty-base/config-scripts
updated setup-env-ext to run the gcp.commands when image is run with a GAE_INSTANCE set
* fixed warnings
* turn off stackdriver logging by default. Added instructions to enable.
* Updates
Update to latest openjdk-runtime with setup-env.d
Update to latest jetty release
* Use the PLATFORM env var
* Improved jetty startup
Added JETTY_PROPERTIES, JETTY_MODULES_ENABLE & JETTY_MODULES_DISABLE
Removed duplicate code fron 50-jetty.bash
* use launcher URL
* Trimmed GCP specific configuration
* Added structure tests for jetty setup script
Also fixed unpack bug found as a result
* Support passing just args
* fix merge
* Fixed test workspace paths for cloud build
* review feedback
* working directory is the root webapp
* Improve handling of various types of command line.
Fixed problem with handling of command line like "ls /var"
Requires duplication of test for java from openjdk-runtime docker-entrypoint.bash,
which should be modified to avoid the duplication.
* upgrade cgloud API version to 0.13.0-beta
* use package target
* tested with FINE log level
* Simplify entrypoint args processing
The $@ arg array is kept complete between all scripts.
* remove debug
* remove debug
* Test that the logging dependencies are hidden from webapp classpath
* update README.md with instructions to keep INFO level on io.grpc.netty.level=INFO
* Updated to lasted openjdk-runtime
* fixed classloader test
* fixed TODO
* Update to jetty 9.4.5 and gcloud 1.0.1-SNAPSHOT
* upgraded to gcloud-logging 1.0.1
* turn off debug
* updated README for latest 1.0.1 gcloud-logging
* update classpath exclusion
\o/
Copy file name to clipboardExpand all lines: README.md
+78-3Lines changed: 78 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -112,15 +112,90 @@ java $JAVA_OPTS \
112
112
-jar $JETTY_HOME/start.jar \
113
113
"$@"
114
114
```
115
+
## Logging
116
+
This image is configured to use [Java Util Logging](https://docs.oracle.com/javase/8/docs/api/java/util/logging/package-summary.html)(JUL) to capture all logging from
117
+
the container and its dependencies. Applications that also use the JUL API will inherit the same logging configuration.
115
118
116
-
The configuration of the jetty container in this image can be viewed by running the image locally:
119
+
By default JUL is configured to use a [ConsoleHandler](https://docs.oracle.com/javase/8/docs/api/java/util/logging/ConsoleHandler.html) to send logs to the `stderr` of the container process. When run on as a GCP deployment, all output to `stderr` is captured and is available via the Stackdriver logging console, however more detailed and integrated logs are available if the Stackdriver logging mechanism is used directly (see below).
120
+
121
+
To alter logging configuration a new `logging.properties` file must be provided to the image that among other things can: alter log levels generated by Loggers; alter log levels accepted by handlers; add/remove/configure log handlers.
122
+
123
+
124
+
### Providing `logging.properties` via the web application
125
+
A new logging configuration file can be provided as part of the application (typically at `WEB-INF/logging.properties`)
126
+
and the Java System Property `java.util.logging.config.file` updated to reference it.
127
+
128
+
When running in a GCP environment, the system property can be set in `app.yaml`:
### Providing `logging.properties` via a custom image
143
+
If this image is being used as the base of a custom image, then the following `Dockerfile` commands can be used to add either replace the existing logging configuration file or to add a new `logging.properties` file.
144
+
145
+
The default logging configuration file is located at `/var/lib/jetty/etc/java-util-logging.properties`, which can be replaced in a custom image is built. The default configuration can be replaced with a `Dockerfile` like:
A `logging.properties` file may be added to an existing images using the `docker run` command if the deployment environment allows for the run arguments to be modified. The `-v` option can be used to bind a new `logging.properties` file to the running instance and the `-e` option can be used to set the system property to point to it:
When running on the Google Cloud Platform Flex environment, the Java Util Logging can be configured to send logs to Google Stackdriver Logging by providing a `logging.properties` file that configures a [LoggingHandler](http://googlecloudplatform.github.io/google-cloud-java/0.10.0/apidocs/com/google/cloud/logging/LoggingHandler.html) as follows:
When deployed on the GCP Flex environment, an image so configured will automatically be configured with:
186
+
* a [LabelLoggingEnhancer](https://github.com/GoogleCloudPlatform/google-cloud-java/blob/v0.17.2/google-cloud-logging/src/main/java/com/google/cloud/logging/MonitoredResourceUtil.java#L224) instance, that will add labels from the monitored resource to each log entry.
187
+
* a [TraceLoggingEnhancer](https://github.com/GoogleCloudPlatform/google-cloud-java/blob/v0.17.2/google-cloud-logging/src/main/java/com/google/cloud/logging/TraceLoggingEnhancer.java) instance that will add any trace-id set to each log entry.
188
+
* the `gcp` module will be enabled that configures jetty so that the [setCurrentTraceId](https://github.com/GoogleCloudPlatform/google-cloud-java/blob/v0.17.2/google-cloud-logging/src/main/java/com/google/cloud/logging/TraceLoggingEnhancer.java#L40) method is called for any thread handling a request.
189
+
190
+
When deployed in other environments, logging enhancers can be manually configured by setting a comma separated list of class names as the
When using Stackdriver logging, it is recommended that `io.grpc` and `sun.net` logging level is kept at INFO level, as both these packages are used by Stackdriver internals and can result in verbose and/or initialisation problems.
194
+
195
+
121
196
## Extending the image
122
197
The image produced by this project may be automatically used/extended by the Cloud SDK and/or App Engine maven plugin.
123
-
Alternately it may be explicitly extended with a custom Dockerfile.
198
+
Alternately it may be explicitly extended with a custom Dockerfile.
124
199
125
200
The latest released version of this image is available at `launcher.gcr.io/google/jetty`, alternately you may
126
201
build and push your own version with the shell commands:
0 commit comments