rickchengx commented on code in PR #13332:
URL: 
https://github.com/apache/dolphinscheduler/pull/13332#discussion_r1062054059


##########
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/runner/WorkerTaskExecuteRunnable.java:
##########
@@ -279,6 +284,25 @@ protected void sendTaskResult() {
                 taskExecutionContext.getCurrentExecutionStatus());
     }
 
+    protected void sendRemoteLogIfNeeded() {
+        if 
("true".equalsIgnoreCase(PropertyUtils.getString(Constants.REMOTE_LOGGING_ENABLE)))
 {
+            try {
+                logger.info("Start to send log {} to remote target {}", 
taskExecutionContext.getLogPath(),
+                        
PropertyUtils.getString(Constants.REMOTE_LOGGING_TARGET));
+                logger.info("Wait log {} to be flushed...", 
taskExecutionContext.getLogPath());
+                Thread.sleep(5000);

Review Comment:
   The reason for waiting here is to allow the final output of the log to be 
written to the local file
   Here is an example.
   
   <img width="1080" alt="截屏2023-01-05 10 19 26" 
src="https://user-images.githubusercontent.com/38122586/210687054-c0a787bf-75c8-4cd2-9a71-077d24464ea4.png";>
   
   The green box in the figure is the last output of the task log, which is 
later than the time when the log is uploaded to the remote storage.
   
   Therefore, if the thread does not use `sleep()`, the log uploaded to the 
remote storage will lose the statements in the green box.
   
   WDYT, or is there any other better way to flush the final output of the log?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to