From d437cb6487487d8e0139ad06e8f75bd003b8db20 Mon Sep 17 00:00:00 2001 From: Jakob Miksch Date: Mon, 20 Jun 2022 17:35:52 +0200 Subject: [PATCH 1/5] Merge branch '2.19-logging-level' --- Dockerfile | 10 +++++ README.md | 19 ++++++++ logging_profiles/DEFAULT_LOGGING.properties | 30 +++++++++++++ .../PRODUCTION_LOGGING.properties | 41 +++++++++++++++++ logging_profiles/QUIET_LOGGING.properties | 22 +++++++++ logging_profiles/VERBOSE_LOGGING.properties | 45 +++++++++++++++++++ startup.sh | 31 +++++++++++++ 7 files changed, 198 insertions(+) create mode 100644 logging_profiles/DEFAULT_LOGGING.properties create mode 100644 logging_profiles/PRODUCTION_LOGGING.properties create mode 100644 logging_profiles/QUIET_LOGGING.properties create mode 100644 logging_profiles/VERBOSE_LOGGING.properties diff --git a/Dockerfile b/Dockerfile index 441763e..debe434 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,7 @@ FROM terrestris/tomcat:8.5.37 ARG GS_VERSION=2.21.0 ARG GS_DATA_PATH=./geoserver_data/ ARG ADDITIONAL_LIBS_PATH=./additional_libs/ +ARG LOGGING_PROFILES_PATH=./logging_profiles/ # Environment variables ENV GEOSERVER_VERSION=$GS_VERSION @@ -17,6 +18,9 @@ ENV EXTRA_JAVA_OPTS="-Xms256m -Xmx1g" ENV USE_VECTOR_TILES=0 ENV USE_WPS=0 ENV USE_CORS=0 +ENV USE_NORCE_LOG4J_JAR=1 +ENV USE_STD_OUT_LOGGING=1 +ENV GEOSERVER_LOG_LEVEL=PRODUCTION # see http://docs.geoserver.org/stable/en/user/production/container.html ENV CATALINA_OPTS="\$EXTRA_JAVA_OPTS -Dfile.encoding=UTF-8 -D-XX:SoftRefLRUPolicyMSPerMB=36000 -Xbootclasspath/a:$CATALINA_HOME/lib/marlin.jar -Xbootclasspath/p:$CATALINA_HOME/lib/marlin-sun-java2d.jar -Dsun.java2d.renderer=org.marlin.pisces.PiscesRenderingEngine -Dorg.geotools.coverage.jaiext.enabled=true" @@ -96,6 +100,12 @@ RUN wget --no-check-certificate https://sourceforge.net/projects/geoserver/files unzip ./$WPS_ZIP_NAME -d ./$WPS_NAME && \ mv ./$WPS_NAME/*.jar $WPS_EXTENSION_PATH +# LOGGING +ENV TMP_DIR_LOGGING_PROFILES=/temp_logging_profiles +# copy prefined logging profiles to temporary directory +# in the entry point script the logging profiles will be copied to the correct location +COPY ${LOGGING_PROFILES_PATH} ${TMP_DIR_LOGGING_PROFILES} + # cleanup RUN apk del curl && \ rm -rf /tmp/* /var/cache/apk/* diff --git a/README.md b/README.md index 43b2eb1..c0200f3 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,25 @@ In order to have individual admin credentials in your running container the envi docker run -e GEOSERVER_ADMIN_USER=peter -e GEOSERVER_ADMIN_PASSWORD=abcd -p 18080:8080 meggsimum/geoserver:2.19.3 ``` +## Set Log Level and Standard Out Logging + +These logging profiles(log levels) are available out of the box: `DEFAULT`, `PRODUCTION`, `QUIET`, `VERBOSE` + +The environment variable `GEOSERVER_LOG_LEVEL` defines the log level of GeoServer. + +```shell +docker run -e GEOSERVER_LOG_LEVEL=PRODUCTION -p 18080:8080 meggsimum/geoserver:2.19.3 +``` + +It is possible to use custom logging profiles by adding them to the `logs` directory within the GeoServer data directory. The filename must match the pattern `PETER_LOGGING.properties`. This profile would then be activated by setting the environment variable `GEOSERVER_LOG_LEVEL=PETER`. + +The environment variable `USE_STD_OUT_LOGGING` defines if logging should be done to standard out. + +```shell +# example how to deactivate logging to standard out +docker run -e USE_STD_OUT_LOGGING=0 -p 18080:8080 meggsimum/geoserver:2.19.3 +``` + ## Build this Image ```shell diff --git a/logging_profiles/DEFAULT_LOGGING.properties b/logging_profiles/DEFAULT_LOGGING.properties new file mode 100644 index 0000000..3efdd0a --- /dev/null +++ b/logging_profiles/DEFAULT_LOGGING.properties @@ -0,0 +1,30 @@ +## This log4j configuration file needs to stay here, and is used as the default logging setup +## during data_dir upgrades and in case the chosen logging config isn't available. + +log4j.rootLogger=WARN, geoserverlogfile, stdout + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{dd MMM HH:mm:ss} %p [%c{2}] - %m%n + + +log4j.appender.geoserverlogfile=org.apache.log4j.RollingFileAppender +# Keep three backup files. +log4j.appender.geoserverlogfile.MaxBackupIndex=3 +# Pattern to output: date priority [category] - message +log4j.appender.geoserverlogfile.layout=org.apache.log4j.PatternLayout +log4j.appender.geoserverlogfile.layout.ConversionPattern=%d %p [%c{2}] - %m%n + +log4j.category.log4j=FATAL + +log4j.category.org.geotools=WARN +log4j.category.org.geotools.factory=WARN +log4j.category.org.geoserver=INFO +log4j.category.org.vfny.geoserver=INFO +log4j.category.org.vfny.geoserver.config.web.tiles.definition.MultipleDefinitionsFactory=WARN +log4j.category.org.vfny.geoserver.global=INFO + +log4j.category.org.springframework=WARN +log4j.category.org.apache.struts=WARN + +log4j.category.org.geowebcache=INFO diff --git a/logging_profiles/PRODUCTION_LOGGING.properties b/logging_profiles/PRODUCTION_LOGGING.properties new file mode 100644 index 0000000..6128eb7 --- /dev/null +++ b/logging_profiles/PRODUCTION_LOGGING.properties @@ -0,0 +1,41 @@ +## This log4j configuration file needs to stay here, and is used as the default logging setup +## during data_dir upgrades and in case the chosen logging config isn't available. +## +## As GeoTools uses java.util.logging logging instead of log4j, GeoServer makes +## the following mappings to adjust the log4j levels specified in this file to +## the GeoTools logging system: +## +## Log4J Level java.util.logging Level +## -------------------------------------------- +## ALL FINEST +## TRACE FINER +## DEBUG FINE (includes CONFIG) +## INFO INFO +## WARN/ERROR WARNING +## FATAL SEVERE +## OFF OFF + +log4j.rootLogger=WARN, geoserverlogfile, stdout + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{dd MMM HH:mm:ss} %p [%c{2}] - %m%n + + +log4j.appender.geoserverlogfile=org.apache.log4j.RollingFileAppender +# Keep three backup files. +log4j.appender.geoserverlogfile.MaxBackupIndex=3 +# Pattern to output: date priority [category] - message +log4j.appender.geoserverlogfile.layout=org.apache.log4j.PatternLayout +log4j.appender.geoserverlogfile.layout.ConversionPattern=%d %p [%c{2}] - %m%n + +log4j.category.log4j=FATAL + +log4j.category.org.geotools=WARN +log4j.category.org.geotools.factory=WARN +log4j.category.org.geoserver=WARN +log4j.category.org.vfny.geoserver=WARN + +log4j.category.org.springframework=WARN + +log4j.category.org.geowebcache=ERROR diff --git a/logging_profiles/QUIET_LOGGING.properties b/logging_profiles/QUIET_LOGGING.properties new file mode 100644 index 0000000..2dea798 --- /dev/null +++ b/logging_profiles/QUIET_LOGGING.properties @@ -0,0 +1,22 @@ +## This log4j configuration file needs to stay here, and is used as the default logging setup +## during data_dir upgrades and in case the chosen logging config isn't available. +## +## As GeoTools uses java.util.logging logging instead of log4j, GeoServer makes +## the following mappings to adjust the log4j levels specified in this file to +## the GeoTools logging system: +## +## Log4J Level java.util.logging Level +## -------------------------------------------- +## ALL FINEST +## TRACE FINER +## DEBUG FINE (includes CONFIG) +## INFO INFO +## ERROR/ERROR ERRORING +## ERROR SEVERE +## OFF OFF + +log4j.rootLogger=OFF, stdout + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{dd MMM HH:mm:ss} %p [%c{2}] - %m%n diff --git a/logging_profiles/VERBOSE_LOGGING.properties b/logging_profiles/VERBOSE_LOGGING.properties new file mode 100644 index 0000000..33bd3e8 --- /dev/null +++ b/logging_profiles/VERBOSE_LOGGING.properties @@ -0,0 +1,45 @@ +## This log4j configuration file needs to stay here, and is used as the default logging setup +## during data_dir upgrades and in case the chosen logging config isn't available. +## +## As GeoTools uses java.util.logging logging instead of log4j, GeoServer makes +## the following mappings to adjust the log4j levels specified in this file to +## the GeoTools logging system: +## +## Log4J Level java.util.logging Level +## -------------------------------------------- +## ALL FINEST +## TRACE FINER +## DEBUG FINE (includes CONFIG) +## INFO INFO +## WARN/ERROR WARNING +## FATAL SEVERE +## OFF OFF + +log4j.rootLogger=WARN, geoserverlogfile, stdout + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{dd MMM HH:mm:ss} %p [%c{2}] - %m%n + +log4j.category.log4j=FATAL + +log4j.appender.geoserverlogfile=org.apache.log4j.RollingFileAppender +# Keep three backup files. +log4j.appender.geoserverlogfile.MaxBackupIndex=3 +# Pattern to output: date priority [category] - message +log4j.appender.geoserverlogfile.layout=org.apache.log4j.PatternLayout +log4j.appender.geoserverlogfile.layout.ConversionPattern=%d %p [%c{2}] - %m%n + + +log4j.category.org.geotools=TRACE +log4j.category.org.geotools.factory=TRACE +log4j.category.org.geotools.renderer=DEBUG +log4j.category.org.geoserver=TRACE +log4j.category.org.vfny.geoserver=TRACE +log4j.category.org.vfny.geoserver.config.web.tiles.definition.MultipleDefinitionsFactory=WARN +log4j.category.org.vfny.geoserver.global=TRACE + +log4j.category.org.springframework=INFO +log4j.category.org.apache.struts=INFO + +log4j.category.org.geowebcache=DEBUG diff --git a/startup.sh b/startup.sh index effbe11..3aca9f7 100755 --- a/startup.sh +++ b/startup.sh @@ -1,5 +1,10 @@ #!/bin/sh +# copy the predefined logging profiles to the GeoServer data directory +DIR_LOGGING_PROFILES=${GEOSERVER_DATA_DIR}logs +mkdir -p ${DIR_LOGGING_PROFILES} +mv ${TMP_DIR_LOGGING_PROFILES}/* ${DIR_LOGGING_PROFILES} + ADDITIONAL_LIBS_DIR=/opt/additional_libs/ # path to default extensions stored in image @@ -34,6 +39,32 @@ if [ -d "$ADDITIONAL_LIBS_DIR" ]; then cp $ADDITIONAL_LIBS_DIR/*.jar $CATALINA_HOME/webapps/$APP_PATH_PREFIX"geoserver/WEB-INF/lib/" fi +# logging level +# inspired by Kartoza GeoServer Docker image +# https://github.com/kartoza/docker-geoserver/blob/f40770a5bbb4f29dc0d107a05aafb5f0da09164a/scripts/functions.sh#L269-L276 +echo "Applying logging level and usage of standard out of logs" + +STD_OUT_LOGGING_VALUE=false +if [ "${USE_STD_OUT_LOGGING}" == 1 ]; then + STD_OUT_LOGGING_VALUE=true +fi + +echo " + ${GEOSERVER_LOG_LEVEL}_LOGGING.properties + ${STD_OUT_LOGGING_VALUE} +" > "${GEOSERVER_DATA_DIR}"/logging.xml + +echo "Set log level to ${GEOSERVER_LOG_LEVEL}" + +# No RCE Log4J Jar (see http://geoserver.org/announcements/2021/12/13/logj4-rce-statement.html) +if [ "$USE_NORCE_LOG4J_JAR" == 1 ]; then + echo "Using the patched norce log4j 1.2.17 jar"; + # remove malicious log4j-1.2.17.jar + rm $CATALINA_HOME/webapps/$APP_PATH_PREFIX"geoserver/WEB-INF/lib/log4j-1.2.17.jar" + # download and install patched log4j jar file into lib folder + wget --no-check-certificate -P $CATALINA_HOME/webapps/$APP_PATH_PREFIX"geoserver/WEB-INF/lib/" https://repo.osgeo.org/repository/geotools-releases/log4j/log4j/1.2.17.norce/log4j-1.2.17.norce.jar +fi + # ENABLE CORS if [ "$USE_CORS" == 1 ]; then echo "Enabling CORS for GeoServer" From 9b3998483043274c7de2acd1e62fa25121f0d6b9 Mon Sep 17 00:00:00 2001 From: Jakob Miksch Date: Tue, 21 Jun 2022 09:25:25 +0200 Subject: [PATCH 2/5] Remove predefined logging profiles --- Dockerfile | 5 --- logging_profiles/DEFAULT_LOGGING.properties | 30 ------------- .../PRODUCTION_LOGGING.properties | 41 ----------------- logging_profiles/QUIET_LOGGING.properties | 22 --------- logging_profiles/VERBOSE_LOGGING.properties | 45 ------------------- startup.sh | 7 +-- 6 files changed, 1 insertion(+), 149 deletions(-) delete mode 100644 logging_profiles/DEFAULT_LOGGING.properties delete mode 100644 logging_profiles/PRODUCTION_LOGGING.properties delete mode 100644 logging_profiles/QUIET_LOGGING.properties delete mode 100644 logging_profiles/VERBOSE_LOGGING.properties diff --git a/Dockerfile b/Dockerfile index debe434..1679f46 100644 --- a/Dockerfile +++ b/Dockerfile @@ -100,11 +100,6 @@ RUN wget --no-check-certificate https://sourceforge.net/projects/geoserver/files unzip ./$WPS_ZIP_NAME -d ./$WPS_NAME && \ mv ./$WPS_NAME/*.jar $WPS_EXTENSION_PATH -# LOGGING -ENV TMP_DIR_LOGGING_PROFILES=/temp_logging_profiles -# copy prefined logging profiles to temporary directory -# in the entry point script the logging profiles will be copied to the correct location -COPY ${LOGGING_PROFILES_PATH} ${TMP_DIR_LOGGING_PROFILES} # cleanup RUN apk del curl && \ diff --git a/logging_profiles/DEFAULT_LOGGING.properties b/logging_profiles/DEFAULT_LOGGING.properties deleted file mode 100644 index 3efdd0a..0000000 --- a/logging_profiles/DEFAULT_LOGGING.properties +++ /dev/null @@ -1,30 +0,0 @@ -## This log4j configuration file needs to stay here, and is used as the default logging setup -## during data_dir upgrades and in case the chosen logging config isn't available. - -log4j.rootLogger=WARN, geoserverlogfile, stdout - -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d{dd MMM HH:mm:ss} %p [%c{2}] - %m%n - - -log4j.appender.geoserverlogfile=org.apache.log4j.RollingFileAppender -# Keep three backup files. -log4j.appender.geoserverlogfile.MaxBackupIndex=3 -# Pattern to output: date priority [category] - message -log4j.appender.geoserverlogfile.layout=org.apache.log4j.PatternLayout -log4j.appender.geoserverlogfile.layout.ConversionPattern=%d %p [%c{2}] - %m%n - -log4j.category.log4j=FATAL - -log4j.category.org.geotools=WARN -log4j.category.org.geotools.factory=WARN -log4j.category.org.geoserver=INFO -log4j.category.org.vfny.geoserver=INFO -log4j.category.org.vfny.geoserver.config.web.tiles.definition.MultipleDefinitionsFactory=WARN -log4j.category.org.vfny.geoserver.global=INFO - -log4j.category.org.springframework=WARN -log4j.category.org.apache.struts=WARN - -log4j.category.org.geowebcache=INFO diff --git a/logging_profiles/PRODUCTION_LOGGING.properties b/logging_profiles/PRODUCTION_LOGGING.properties deleted file mode 100644 index 6128eb7..0000000 --- a/logging_profiles/PRODUCTION_LOGGING.properties +++ /dev/null @@ -1,41 +0,0 @@ -## This log4j configuration file needs to stay here, and is used as the default logging setup -## during data_dir upgrades and in case the chosen logging config isn't available. -## -## As GeoTools uses java.util.logging logging instead of log4j, GeoServer makes -## the following mappings to adjust the log4j levels specified in this file to -## the GeoTools logging system: -## -## Log4J Level java.util.logging Level -## -------------------------------------------- -## ALL FINEST -## TRACE FINER -## DEBUG FINE (includes CONFIG) -## INFO INFO -## WARN/ERROR WARNING -## FATAL SEVERE -## OFF OFF - -log4j.rootLogger=WARN, geoserverlogfile, stdout - -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d{dd MMM HH:mm:ss} %p [%c{2}] - %m%n - - -log4j.appender.geoserverlogfile=org.apache.log4j.RollingFileAppender -# Keep three backup files. -log4j.appender.geoserverlogfile.MaxBackupIndex=3 -# Pattern to output: date priority [category] - message -log4j.appender.geoserverlogfile.layout=org.apache.log4j.PatternLayout -log4j.appender.geoserverlogfile.layout.ConversionPattern=%d %p [%c{2}] - %m%n - -log4j.category.log4j=FATAL - -log4j.category.org.geotools=WARN -log4j.category.org.geotools.factory=WARN -log4j.category.org.geoserver=WARN -log4j.category.org.vfny.geoserver=WARN - -log4j.category.org.springframework=WARN - -log4j.category.org.geowebcache=ERROR diff --git a/logging_profiles/QUIET_LOGGING.properties b/logging_profiles/QUIET_LOGGING.properties deleted file mode 100644 index 2dea798..0000000 --- a/logging_profiles/QUIET_LOGGING.properties +++ /dev/null @@ -1,22 +0,0 @@ -## This log4j configuration file needs to stay here, and is used as the default logging setup -## during data_dir upgrades and in case the chosen logging config isn't available. -## -## As GeoTools uses java.util.logging logging instead of log4j, GeoServer makes -## the following mappings to adjust the log4j levels specified in this file to -## the GeoTools logging system: -## -## Log4J Level java.util.logging Level -## -------------------------------------------- -## ALL FINEST -## TRACE FINER -## DEBUG FINE (includes CONFIG) -## INFO INFO -## ERROR/ERROR ERRORING -## ERROR SEVERE -## OFF OFF - -log4j.rootLogger=OFF, stdout - -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d{dd MMM HH:mm:ss} %p [%c{2}] - %m%n diff --git a/logging_profiles/VERBOSE_LOGGING.properties b/logging_profiles/VERBOSE_LOGGING.properties deleted file mode 100644 index 33bd3e8..0000000 --- a/logging_profiles/VERBOSE_LOGGING.properties +++ /dev/null @@ -1,45 +0,0 @@ -## This log4j configuration file needs to stay here, and is used as the default logging setup -## during data_dir upgrades and in case the chosen logging config isn't available. -## -## As GeoTools uses java.util.logging logging instead of log4j, GeoServer makes -## the following mappings to adjust the log4j levels specified in this file to -## the GeoTools logging system: -## -## Log4J Level java.util.logging Level -## -------------------------------------------- -## ALL FINEST -## TRACE FINER -## DEBUG FINE (includes CONFIG) -## INFO INFO -## WARN/ERROR WARNING -## FATAL SEVERE -## OFF OFF - -log4j.rootLogger=WARN, geoserverlogfile, stdout - -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d{dd MMM HH:mm:ss} %p [%c{2}] - %m%n - -log4j.category.log4j=FATAL - -log4j.appender.geoserverlogfile=org.apache.log4j.RollingFileAppender -# Keep three backup files. -log4j.appender.geoserverlogfile.MaxBackupIndex=3 -# Pattern to output: date priority [category] - message -log4j.appender.geoserverlogfile.layout=org.apache.log4j.PatternLayout -log4j.appender.geoserverlogfile.layout.ConversionPattern=%d %p [%c{2}] - %m%n - - -log4j.category.org.geotools=TRACE -log4j.category.org.geotools.factory=TRACE -log4j.category.org.geotools.renderer=DEBUG -log4j.category.org.geoserver=TRACE -log4j.category.org.vfny.geoserver=TRACE -log4j.category.org.vfny.geoserver.config.web.tiles.definition.MultipleDefinitionsFactory=WARN -log4j.category.org.vfny.geoserver.global=TRACE - -log4j.category.org.springframework=INFO -log4j.category.org.apache.struts=INFO - -log4j.category.org.geowebcache=DEBUG diff --git a/startup.sh b/startup.sh index 3aca9f7..2e3075c 100755 --- a/startup.sh +++ b/startup.sh @@ -1,10 +1,5 @@ #!/bin/sh -# copy the predefined logging profiles to the GeoServer data directory -DIR_LOGGING_PROFILES=${GEOSERVER_DATA_DIR}logs -mkdir -p ${DIR_LOGGING_PROFILES} -mv ${TMP_DIR_LOGGING_PROFILES}/* ${DIR_LOGGING_PROFILES} - ADDITIONAL_LIBS_DIR=/opt/additional_libs/ # path to default extensions stored in image @@ -50,7 +45,7 @@ if [ "${USE_STD_OUT_LOGGING}" == 1 ]; then fi echo " - ${GEOSERVER_LOG_LEVEL}_LOGGING.properties + ${GEOSERVER_LOG_LEVEL}_LOGGING.xml ${STD_OUT_LOGGING_VALUE} " > "${GEOSERVER_DATA_DIR}"/logging.xml From 8c18134fadf4d303cc7feba97663f08d9dba2c38 Mon Sep 17 00:00:00 2001 From: Jakob Miksch Date: Tue, 21 Jun 2022 09:29:25 +0200 Subject: [PATCH 3/5] Remove not needed legacy code --- Dockerfile | 3 --- startup.sh | 9 --------- 2 files changed, 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1679f46..6cf669d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,6 @@ FROM terrestris/tomcat:8.5.37 ARG GS_VERSION=2.21.0 ARG GS_DATA_PATH=./geoserver_data/ ARG ADDITIONAL_LIBS_PATH=./additional_libs/ -ARG LOGGING_PROFILES_PATH=./logging_profiles/ # Environment variables ENV GEOSERVER_VERSION=$GS_VERSION @@ -18,7 +17,6 @@ ENV EXTRA_JAVA_OPTS="-Xms256m -Xmx1g" ENV USE_VECTOR_TILES=0 ENV USE_WPS=0 ENV USE_CORS=0 -ENV USE_NORCE_LOG4J_JAR=1 ENV USE_STD_OUT_LOGGING=1 ENV GEOSERVER_LOG_LEVEL=PRODUCTION @@ -100,7 +98,6 @@ RUN wget --no-check-certificate https://sourceforge.net/projects/geoserver/files unzip ./$WPS_ZIP_NAME -d ./$WPS_NAME && \ mv ./$WPS_NAME/*.jar $WPS_EXTENSION_PATH - # cleanup RUN apk del curl && \ rm -rf /tmp/* /var/cache/apk/* diff --git a/startup.sh b/startup.sh index 2e3075c..5ced210 100755 --- a/startup.sh +++ b/startup.sh @@ -51,15 +51,6 @@ echo " echo "Set log level to ${GEOSERVER_LOG_LEVEL}" -# No RCE Log4J Jar (see http://geoserver.org/announcements/2021/12/13/logj4-rce-statement.html) -if [ "$USE_NORCE_LOG4J_JAR" == 1 ]; then - echo "Using the patched norce log4j 1.2.17 jar"; - # remove malicious log4j-1.2.17.jar - rm $CATALINA_HOME/webapps/$APP_PATH_PREFIX"geoserver/WEB-INF/lib/log4j-1.2.17.jar" - # download and install patched log4j jar file into lib folder - wget --no-check-certificate -P $CATALINA_HOME/webapps/$APP_PATH_PREFIX"geoserver/WEB-INF/lib/" https://repo.osgeo.org/repository/geotools-releases/log4j/log4j/1.2.17.norce/log4j-1.2.17.norce.jar -fi - # ENABLE CORS if [ "$USE_CORS" == 1 ]; then echo "Enabling CORS for GeoServer" From 4c3c0c2514e3be9db4b026b6351cead163eb0add Mon Sep 17 00:00:00 2001 From: Jakob Miksch Date: Tue, 21 Jun 2022 09:45:39 +0200 Subject: [PATCH 4/5] Update README --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c0200f3..63f2b92 100644 --- a/README.md +++ b/README.md @@ -89,23 +89,23 @@ docker run -e GEOSERVER_ADMIN_USER=peter -e GEOSERVER_ADMIN_PASSWORD=abcd -p 180 ## Set Log Level and Standard Out Logging -These logging profiles(log levels) are available out of the box: `DEFAULT`, `PRODUCTION`, `QUIET`, `VERBOSE` - -The environment variable `GEOSERVER_LOG_LEVEL` defines the log level of GeoServer. +The environment variable `GEOSERVER_LOG_LEVEL` defines the log level of GeoServer. All predefined log levels of GeoServer are available. Default is `PRODUCTION`. ```shell -docker run -e GEOSERVER_LOG_LEVEL=PRODUCTION -p 18080:8080 meggsimum/geoserver:2.19.3 +docker run -e GEOSERVER_LOG_LEVEL=PRODUCTION -p 18080:8080 meggsimum/geoserver:2.21.0 ``` -It is possible to use custom logging profiles by adding them to the `logs` directory within the GeoServer data directory. The filename must match the pattern `PETER_LOGGING.properties`. This profile would then be activated by setting the environment variable `GEOSERVER_LOG_LEVEL=PETER`. +It is possible to use custom logging profiles by adding them to the `logs` directory within the GeoServer data directory. The filename must match the pattern `PETER_LOGGING.xml`. This profile would then be activated by setting the environment variable `GEOSERVER_LOG_LEVEL=PETER`. The environment variable `USE_STD_OUT_LOGGING` defines if logging should be done to standard out. ```shell # example how to deactivate logging to standard out -docker run -e USE_STD_OUT_LOGGING=0 -p 18080:8080 meggsimum/geoserver:2.19.3 +docker run -e USE_STD_OUT_LOGGING=0 -p 18080:8080 meggsimum/geoserver:2.21.0 ``` +Note that starting from GeoServer version 2.21 the logging has been written completely new. If you update from older GeoServer versions there might be adaptations necessary. More information are available in the changelog of GeoServer: https://geoserver.org/announcements/2022/05/24/geoserver-2-21-0-released.html#log4j-2-upgrade + ## Build this Image ```shell From f332b9d06185ee97ac0072bb47b0a45894141e8f Mon Sep 17 00:00:00 2001 From: Jakob Miksch Date: Fri, 15 Jul 2022 11:48:44 +0200 Subject: [PATCH 5/5] Update README --- README.md | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 92e2c95..0fda430 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,8 @@ you'll get a cleaned standard GeoServer (Version 2.19.3), which can be accessed - `GEOSERVER_ADMIN_USER` (String - supported since 2.19.x) Default is `admin` - `GEOSERVER_ADMIN_PASSWORD` (String - supported since 2.19.x) Default is `geoserver` - `UPDATE_CREDENTIALS` (0/1) If the credentials shall be updated on startup. Default is `0` + - `USE_STD_OUT_LOGGING` (0/1) If logs should be written to standard out. Default is `1` + - `GEOSERVER_LOG_LEVEL` See detailed description in section below. Default is `PRODUCTION` For detailed information check the sections below. @@ -101,24 +103,17 @@ Setting `UPDATE_CREDENTIALS` to `0` does not update the credentials on startup. docker run -e UPDATE_CREDENTIALS=0 -v $(pwd)/geoserver_data:/opt/geoserver_data -p 8080:8080 meggsimum/geoserver:latest ``` -## Set Log Level and Standard Out Logging +## Log Level The environment variable `GEOSERVER_LOG_LEVEL` defines the log level of GeoServer. All predefined log levels of GeoServer are available. Default is `PRODUCTION`. ```shell -docker run -e GEOSERVER_LOG_LEVEL=PRODUCTION -p 18080:8080 meggsimum/geoserver:2.21.0 +docker run -e GEOSERVER_LOG_LEVEL=PRODUCTION -p 8080:8080 meggsimum/geoserver:2.21.0 ``` It is possible to use custom logging profiles by adding them to the `logs` directory within the GeoServer data directory. The filename must match the pattern `PETER_LOGGING.xml`. This profile would then be activated by setting the environment variable `GEOSERVER_LOG_LEVEL=PETER`. -The environment variable `USE_STD_OUT_LOGGING` defines if logging should be done to standard out. - -```shell -# example how to deactivate logging to standard out -docker run -e USE_STD_OUT_LOGGING=0 -p 18080:8080 meggsimum/geoserver:2.21.0 -``` - -Note that starting from GeoServer version 2.21 the logging has been written completely new. If you update from older GeoServer versions there might be adaptations necessary. More information are available in the changelog of GeoServer: https://geoserver.org/announcements/2022/05/24/geoserver-2-21-0-released.html#log4j-2-upgrade +Note that starting from GeoServer version 2.21 on the logging has been rewritten completely. If you update from older GeoServer versions there might be adaptations necessary. More information are available in the changelog of GeoServer: https://geoserver.org/announcements/2022/05/24/geoserver-2-21-0-released.html#log4j-2-upgrade ## Build this Image