core icon indicating copy to clipboard operation
core copied to clipboard

Issue 23631 create global log4j

Open spbolton opened this issue 2 years ago • 7 comments

Updated pull request from https://github.com/dotCMS/core/pull/23632 Issue #23631 Enable log configuration by setting environment variable USE_GLOBAL_LOG4J=true

Default logging config found in log4j2/conf/log4j2-tomcat.xml

bin/setclasspath.sh or bin/setclasspath.bat contains logic to setup

if [ "$USE_GLOBAL_LOG4J" = true ]; then echo Using Global Log4j CLASSPATH="$CATALINA_HOME/log4j2/lib/*:$CATALINA_HOME/log4j2/conf$CLASSPATH" JAVA_OPTS=" -DLog4jContextSelector=org.apache.logging.log4j.core.async.BasicAsyncLoggerContextSelector $JAVA_OPTS" JAVA_OPTS=" -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager $JAVA_OPTS" fi

default Context selector creates a new context per Classloader and requires separate configuration for each. BasicContextSelection keeps the same context and configuration for all Classloaders, for each there is an Async version that makes all the loggers asynchronous and improves performance.

The log4j jars have been added to $CATALINA_HOME/log4j2/lib to support slf4j, commons-logging, Jul logging log4j 1. A log4j2-appserver jar is set up to replace the standard tomcat logging. Although the log4j2-appserver replaces the jul logging in tomcat directly Some plugin code uses java.util.logging and the LogManger needs to be set to pass this logging back to log4j.

By default the logfile is picked up from the classpath and found in CATALINA_HOME/log4j2/conf see

https://logging.apache.org/log4j/2.x/log4j-appserver/index.html

The log file could be specified with a jvm option -Dlog4j.configurationFile=path/to/log4j2.xml or map the file/folder in docker.

Read configuration guide https://logging.apache.org/log4j/2.x/manual/configuration.html on how to modify the config,https://logging.apache.org/log4j/2.x/manual/configuration.html It is currently set to only log to stdout. for docker.

spbolton avatar Jan 31 '23 20:01 spbolton

Unit Tests Report

1 418 tests  ±0   1 408 :heavy_check_mark: ±0   3m 47s :stopwatch: -15s    140 suites ±0        10 :zzz: ±0     140 files   ±0          0 :x: ±0 

Results for commit aa5f8668. ± Comparison against base commit adfff759.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar Jan 31 '23 20:01 github-actions[bot]

Postman Tests Report

0 files   -      54  0 suites   - 733   0s :stopwatch: - 1h 31m 11s 0 tests  -    362  0 :heavy_check_mark:  -    361  0 :zzz: ±0  0 :x:  - 1  0 runs   - 1 118  0 :heavy_check_mark:  - 1 113  0 :zzz: ±0  0 :x:  - 5 

Results for commit c0b488f2. ± Comparison against base commit 9d691ee9.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar Jan 31 '23 20:01 github-actions[bot]

Integration Tests [postgres] Report

   408 files   -   1     408 suites   - 1   58m 59s :stopwatch: - 10m 16s 3 878 tests  - 14  3 734 :heavy_check_mark:  - 134  23 :zzz: ±0  121 :x: +120  3 900 runs   - 13  3 755 :heavy_check_mark:  - 134  23 :zzz: ±0  122 :x: +121 

For more details on these failures, see this check.

Results for commit aa5f8668. ± Comparison against base commit adfff759.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar Jan 31 '23 21:01 github-actions[bot]

Integration Tests [mssql] Report

0 tests  ±0   0 :heavy_check_mark: ±0   0s :stopwatch: ±0s 0 suites ±0   0 :zzz: ±0  0 files   ±0   0 :x: ±0 

Results for commit aa5f8668. ± Comparison against base commit adfff759.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar Jan 31 '23 23:01 github-actions[bot]

SonarQube Quality Gate

Quality Gate failed

Failed condition C Reliability Rating on New Code (is worse than A)
Failed condition 14.9% 14.92% Coverage on New Code (is less than 80%)

See analysis details on SonarQube

Fix issues before they fail your Quality Gate with SonarLint SonarLint in your IDE.

dotcms-sonarqube[bot] avatar Feb 07 '23 16:02 dotcms-sonarqube[bot]

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Mar 10 '23 02:03 github-actions[bot]

This PR was closed because it has been stalled with no activity.

github-actions[bot] avatar Mar 18 '23 01:03 github-actions[bot]

github app test @dotbot joke

spbolton avatar Feb 07 '25 13:02 spbolton

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Aug 04 '25 02:08 github-actions[bot]

This PR was closed because it has been stalled with no activity.

github-actions[bot] avatar Aug 12 '25 02:08 github-actions[bot]