From 5def58407942b1ae4a3d0e91dfe6ce4dcd40b0ce Mon Sep 17 00:00:00 2001 From: Jean-Francois Denise Date: Thu, 4 Jan 2024 15:12:21 +0100 Subject: [PATCH] Fix logging qs to work with openshift profile --- logging/README.adoc | 3 ++- logging/cli-openshift.properties | 1 + logging/cli.properties | 1 + logging/configure-logging.cli | 12 ++++++------ logging/pom.xml | 14 +++++++++----- 5 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 logging/cli-openshift.properties create mode 100644 logging/cli.properties diff --git a/logging/README.adoc b/logging/README.adoc index 8e066f1331..4b934a5323 100644 --- a/logging/README.adoc +++ b/logging/README.adoc @@ -70,11 +70,12 @@ Now you have deployed the quickstart with the default configuration, you run a m . Review the `configure-logging.cli` file in the root of this quickstart directory. This script configures the logging subsystem in the server configuration file. It configures the file handlers, creates the logger for our quickstart and sets the level to TRACE. It also assigns the handlers for our quickstart to our logger. +. The CLI script references the logging formatter with the property `${formatter}`. On bare-metal this formatter is named `PATTERN`, on OpenShift it is named `OPENSHIFT`. A properties file is to be provided when executing the CLI to resolve the `formatter` property according to the execution context. The file `cli.properties` is to be used when executing the script on bare-metal. `cli-openshift.properties` is to be used when executing the script on OpenShift. . Open a new terminal, navigate to the root directory of this quickstart, and run the following command, replacing `__{jbossHomeName}__` with the path to your server: + [source,subs="+quotes,attributes+",options="nowrap"] ---- -$ __{jbossHomeName}__/bin/jboss-cli.sh --connect --file=configure-logging.cli +$ __{jbossHomeName}__/bin/jboss-cli.sh --connect --file=configure-logging.cli --resolve-parameter-values=true --properties=cli.properties ---- + NOTE: For Windows, use the `__{jbossHomeName}__\bin\jboss-cli.bat` script. diff --git a/logging/cli-openshift.properties b/logging/cli-openshift.properties new file mode 100644 index 0000000000..23c5ac90c4 --- /dev/null +++ b/logging/cli-openshift.properties @@ -0,0 +1 @@ +formatter=OPENSHIFT \ No newline at end of file diff --git a/logging/cli.properties b/logging/cli.properties new file mode 100644 index 0000000000..d3c0192cd6 --- /dev/null +++ b/logging/cli.properties @@ -0,0 +1 @@ +formatter=PATTERN \ No newline at end of file diff --git a/logging/configure-logging.cli b/logging/configure-logging.cli index 816c0ef6ff..6fabba41c6 100644 --- a/logging/configure-logging.cli +++ b/logging/configure-logging.cli @@ -1,10 +1,10 @@ # Add the periodic rotating file handlers corresponding to those added to the logging properties file -/subsystem=logging/file-handler=FILE_QS_TRACE:add(append=false, level=TRACE, named-formatter=PATTERN, file={"path"=>"quickstart-trace.log", "relative-to"=>"jboss.server.log.dir"}) -/subsystem=logging/file-handler=FILE_QS_DEBUG:add(append=false, level=DEBUG, named-formatter=PATTERN, file={"path"=>"quickstart-debug.log", "relative-to"=>"jboss.server.log.dir"}) -/subsystem=logging/file-handler=FILE_QS_INFO:add(append=false, level=INFO, named-formatter=PATTERN, file={"path"=>"quickstart-info.log", "relative-to"=>"jboss.server.log.dir"}) -/subsystem=logging/file-handler=FILE_QS_WARN:add(append=false, level=WARN, named-formatter=PATTERN, file={"path"=>"quickstart-warn.log", "relative-to"=>"jboss.server.log.dir"}) -/subsystem=logging/file-handler=FILE_QS_ERROR:add(append=false, level=ERROR, named-formatter=PATTERN, file={"path"=>"quickstart-error.log", "relative-to"=>"jboss.server.log.dir"}) -/subsystem=logging/file-handler=FILE_QS_FATAL:add(append=false, level=FATAL, named-formatter=PATTERN, file={"path"=>"quickstart-fatal.log", "relative-to"=>"jboss.server.log.dir"}) +/subsystem=logging/file-handler=FILE_QS_TRACE:add(append=false, level=TRACE, named-formatter=${formatter}, file={"path"=>"quickstart-trace.log", "relative-to"=>"jboss.server.log.dir"}) +/subsystem=logging/file-handler=FILE_QS_DEBUG:add(append=false, level=DEBUG, named-formatter=${formatter}, file={"path"=>"quickstart-debug.log", "relative-to"=>"jboss.server.log.dir"}) +/subsystem=logging/file-handler=FILE_QS_INFO:add(append=false, level=INFO, named-formatter=${formatter}, file={"path"=>"quickstart-info.log", "relative-to"=>"jboss.server.log.dir"}) +/subsystem=logging/file-handler=FILE_QS_WARN:add(append=false, level=WARN, named-formatter=${formatter}, file={"path"=>"quickstart-warn.log", "relative-to"=>"jboss.server.log.dir"}) +/subsystem=logging/file-handler=FILE_QS_ERROR:add(append=false, level=ERROR, named-formatter=${formatter}, file={"path"=>"quickstart-error.log", "relative-to"=>"jboss.server.log.dir"}) +/subsystem=logging/file-handler=FILE_QS_FATAL:add(append=false, level=FATAL, named-formatter=${formatter}, file={"path"=>"quickstart-fatal.log", "relative-to"=>"jboss.server.log.dir"}) # Create the logger for our quickstart class and assign the handlers /subsystem=logging/logger=org.jboss.as.quickstarts.logging:add(handlers=[FILE_QS_TRACE,FILE_QS_DEBUG,FILE_QS_INFO,FILE_QS_WARN,FILE_QS_ERROR,FILE_QS_FATAL]) diff --git a/logging/pom.xml b/logging/pom.xml index 1b3a1ba359..64d79a5d7e 100644 --- a/logging/pom.xml +++ b/logging/pom.xml @@ -174,8 +174,10 @@ - - false + + ${project.basedir}${file.separator}cli.properties + + true @@ -200,7 +202,7 @@ ${version.plugin.wildfly} - ROOT.war + ROOT.war ${version.server} cloud @@ -211,8 +213,10 @@ - - false + + ${project.basedir}${file.separator}cli-openshift.properties + + true