From 8ad3617044bca10e19be9bd746a87076d2621cb0 Mon Sep 17 00:00:00 2001 From: Tobias Trabelsi <64127335+tobias-trabelsi-sonarsource@users.noreply.github.com> Date: Fri, 4 Dec 2020 11:04:37 +0100 Subject: [PATCH] SONAR-10662 updated docs to match wrapper behaviour --- .../pages/instance-administration/system-info.md | 14 ++++++++++++++ .../src/main/assembly/conf/sonar.properties | 3 ++- .../src/main/assembly/conf/wrapper.conf | 3 ++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/server/sonar-docs/src/pages/instance-administration/system-info.md b/server/sonar-docs/src/pages/instance-administration/system-info.md index 68a1ba3eaf4..a7386de183b 100644 --- a/server/sonar-docs/src/pages/instance-administration/system-info.md +++ b/server/sonar-docs/src/pages/instance-administration/system-info.md @@ -45,6 +45,20 @@ To control log rolling, use the `sonar.log.rollingPolicy` `sonar.log.maxFiles` is the maximum number of files to keep. This property is ignored if `sonar.log.rollingPolicy=none`. +#### **Wrapper Config** + +If Sonarqube was started using the SonarQube wrapper (for example, by using the provided start and stop scripts), the log rotation of the main Process (sonar.log) needs to be defined in the `wrapper.conf`. +By Default, the wrapper will rotate the `sonar.log` file each day if there is new content to be logged. + +The log rotation in the wrapper can be fine-tuned with the following properties: + +* **`wrapper.logfile.maxsize=value[m for mb, k for kb]`** +* **`wrapper.logfile.maxfiles=value`** +* **`wrapper.logfile.rollmode=DATE|SIZE`** + +`wrapper.logfile.maxsize` and `wrapper.logfile.maxfiles` are only considered if `wrapper.logfile.rollmode` is set to `SIZE`. +For `wrapper.logfile.rollmode=DATE` to work properly, the file defined with the property `wrapper.logfile` needs to include a "YYYYMMDD" Token. + ### UI Access to Logs and Log Levels The System Info page gives you the ability to download your instance's current log files (log files rotate on a regular basis), and to tune the log level via controls at the top of the page. Changes made here are temporary, and last only until the next time the instance is restarted, at which point the level will be reset to the more permanent value set in _$SONARQUBE-HOME/conf/sonar.properties_. Regardless, if you change your log level _from_ `INFO`, but sure to change it back as soon as is practical; log files can get very large very quickly at lower log levels. diff --git a/sonar-application/src/main/assembly/conf/sonar.properties b/sonar-application/src/main/assembly/conf/sonar.properties index 109cafd5a12..98ccb45e65b 100644 --- a/sonar-application/src/main/assembly/conf/sonar.properties +++ b/sonar-application/src/main/assembly/conf/sonar.properties @@ -327,8 +327,9 @@ # Compute Engine (aka. CE) logs in ce.log # Elasticsearch (aka. ES) logs in es.log # -# All 4 files follow the same rolling policy (see sonar.log.rollingPolicy and sonar.log.maxFiles) but it applies +# Depending on the startup, all 4 files follow the same rolling policy (see sonar.log.rollingPolicy and sonar.log.maxFiles) but it applies # individually (eg. if sonar.log.maxFiles=4, there can be at most 4 of each files, ie. 16 files in total). +# If the SonarQube wrapper is used (for example, with the provided start.sh script), the sonar.log rotation policy needs to be set in the wrapper.conf # # All 4 files have logs in the same format: # 1 2 3 4 5 6 diff --git a/sonar-application/src/main/assembly/conf/wrapper.conf b/sonar-application/src/main/assembly/conf/wrapper.conf index dcadc77e0a5..fbc3e116e7c 100644 --- a/sonar-application/src/main/assembly/conf/wrapper.conf +++ b/sonar-application/src/main/assembly/conf/wrapper.conf @@ -29,9 +29,10 @@ wrapper.java.maxmemory=32 wrapper.console.format=PM wrapper.console.loglevel=INFO -wrapper.logfile=../../logs/sonar.log wrapper.logfile.format=M wrapper.logfile.loglevel=INFO +wrapper.logfile.rollmode=DATE +wrapper.logfile=../../logs/sonar-YYYYMMDD.log # Maximum size that the log file will be allowed to grow to before # the log is rolled. Size is specified in bytes. The default value -- 2.39.5