From 6d79414491f38611bebf32d632eb88b4be213e2a Mon Sep 17 00:00:00 2001 From: Eric Gao Date: Mon, 7 Nov 2022 10:30:56 +0800 Subject: [PATCH] Add instructions on how to configure logging level for debugging purpose (#12699) --- docs/docs/en/contribute/log-specification.md | 28 ++++++++++++++++--- docs/docs/zh/contribute/log-specification.md | 20 +++++++++++++ .../src/main/resources/logback-spring.xml | 3 -- .../src/main/resources/logback-spring.xml | 3 -- 4 files changed, 44 insertions(+), 10 deletions(-) diff --git a/docs/docs/en/contribute/log-specification.md b/docs/docs/en/contribute/log-specification.md index 9746b05ca4..be6bd251cc 100644 --- a/docs/docs/en/contribute/log-specification.md +++ b/docs/docs/en/contribute/log-specification.md @@ -1,4 +1,4 @@ -# Log specification +# Logging specification ## Preface @@ -8,7 +8,7 @@ Apache DolphinScheduler uses the Logback logging framework to print logs accordi ## Specifications -### Log level specification +### Logging level specification Different levels of logs play different roles in the business process, and failure to use reasonable log levels for printing can cause great difficulties for system operations and maintenance. @@ -17,7 +17,7 @@ Different levels of logs play different roles in the business process, and failu - WARN level is used to warn of problems that will occur during operation. For example, the checksum of API module parameters, etc. - ERROR level is used to record some unpredictable errors and exceptions that will affect the system process. For example, errors and exceptions that cause workflows and tasks to fail to complete properly. -### Log content specification +### Logging content specification The content of the logs determines whether the logs can completely restore the system behavior or state. @@ -33,7 +33,7 @@ The content of the logs determines whether the logs can completely restore the s logger.error("description of current error, parameter is {}", parameter, e); ``` -### Log format specification +### Logging format specification The logs of Master module and Worker module are printed using the following format. @@ -43,6 +43,26 @@ The logs of Master module and Worker module are printed using the following form That is, the workflow instance ID and task instance ID are injected in the printed logs using MDC, so the developer needs to get the IDs and inject them before printing the logs related to the workflow instance and task instance in these two modules; after the printing is finished, the related IDs need to be removed. +## Logging Configuration + +DolphinScheduler uses [LogBack](https://docs.spring.io/spring-boot/docs/2.1.8.RELEASE/reference/html/howto-logging.html) for logging. To change the logging level of a specific package, you need to modify the `logback-spring.xml` file for the corresponding module. +For example, if you want to enable `DEBUG` logging for `org.springframework.web` package in `standalone` module, you need to add the following configurations in `apache-dolphinscheduler-dev-SNAPSHOT-bin/standalone-server/conf/logback-spring.xml`: + +```xml + + +...... + + + + + + +...... + + +``` + ## Cautions - Disable the use of standard output to print logs. Standard output can greatly affect system performance. diff --git a/docs/docs/zh/contribute/log-specification.md b/docs/docs/zh/contribute/log-specification.md index 04d3103fff..ab920e191d 100644 --- a/docs/docs/zh/contribute/log-specification.md +++ b/docs/docs/zh/contribute/log-specification.md @@ -41,6 +41,26 @@ Master模块和Worker模块的日志打印使用如下格式。即在打印的 [%level] %date{yyyy-MM-dd HH:mm:ss.SSS Z} %logger{96}:[%line] - [WorkflowInstance-%X{workflowInstanceId:-0}][TaskInstance-%X{taskInstanceId:-0}] - %msg%n ``` +## 日志配置修改 + +DolphinScheduler使用[`LogBack`](https://docs.spring.io/spring-boot/docs/2.1.8.RELEASE/reference/html/howto-logging.html)作为日志工具。若您要修改某个包的日志打点级别,您需要修改对应模块的`logback-spring.xml`文件。 +举例来说,若您需要将`standalone`模式下`org.springframework.web`包日志提升到`DEBUG`级别,您需要在`apache-dolphinscheduler-dev-SNAPSHOT-bin/standalone-server/conf/logback-spring.xml`文件中加入如下配置: + +```xml + + +...... + + + + + + +...... + + +``` + ## 注意事项 - 禁止使用标准输出打印日志。标准输出会极大影响系统性能。 diff --git a/dolphinscheduler-api/src/main/resources/logback-spring.xml b/dolphinscheduler-api/src/main/resources/logback-spring.xml index 60fa20509f..d80fbf84d4 100644 --- a/dolphinscheduler-api/src/main/resources/logback-spring.xml +++ b/dolphinscheduler-api/src/main/resources/logback-spring.xml @@ -30,9 +30,6 @@ ${log.base}/dolphinscheduler-api.log - - INFO - ${log.base}/dolphinscheduler-api.%d{yyyy-MM-dd_HH}.%i.log 168 diff --git a/dolphinscheduler-standalone-server/src/main/resources/logback-spring.xml b/dolphinscheduler-standalone-server/src/main/resources/logback-spring.xml index 551225eb1a..79c3ae8ff9 100644 --- a/dolphinscheduler-standalone-server/src/main/resources/logback-spring.xml +++ b/dolphinscheduler-standalone-server/src/main/resources/logback-spring.xml @@ -30,9 +30,6 @@ ${log.base}/dolphinscheduler-standalone.log - - INFO - ${log.base}/dolphinscheduler-standalone.%d{yyyy-MM-dd_HH}.%i.log 168