This is an automated email from the ASF dual-hosted git repository.

klesh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new fed1d888 fix: log errors at the subtask level (#3863)
fed1d888 is described below

commit fed1d888e474ce37f989c89d9c3f61f3e8c005ca
Author: Keon Amini <[email protected]>
AuthorDate: Mon Dec 5 19:34:44 2022 -0600

    fix: log errors at the subtask level (#3863)
---
 logger/init.go     | 6 +++++-
 runner/run_task.go | 4 +++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/logger/init.go b/logger/init.go
index 55ec74f0..7daee9ba 100644
--- a/logger/init.go
+++ b/logger/init.go
@@ -54,7 +54,11 @@ func init() {
        if basePath == "" {
                inner.Warn("LOGGING_DIR is not set. Log files will not be 
generated.")
        } else {
-               basePath = filepath.Join(basePath, "devlake.log")
+               abs, err := filepath.Abs(basePath)
+               if err != nil {
+                       panic(err)
+               }
+               basePath = filepath.Join(abs, "devlake.log")
        }
        var err errors.Error
        Global, err = NewDefaultLogger(inner)
diff --git a/runner/run_task.go b/runner/run_task.go
index 8e6bedc5..56fa381b 100644
--- a/runner/run_task.go
+++ b/runner/run_task.go
@@ -280,7 +280,9 @@ func RunPluginSubTasks(
                }
                err = runSubtask(log, db, taskID, subtaskNumber, subtaskCtx, 
subtaskMeta.EntryPoint)
                if err != nil {
-                       return errors.SubtaskErr.Wrap(err, fmt.Sprintf("subtask 
%s ended unexpectedly", subtaskMeta.Name), errors.WithData(&subtaskMeta))
+                       err = errors.SubtaskErr.Wrap(err, fmt.Sprintf("subtask 
%s ended unexpectedly", subtaskMeta.Name), errors.WithData(&subtaskMeta))
+                       log.Error(err, "")
+                       return err
                }
                taskCtx.IncProgress(1)
        }

Reply via email to