[PR #2631] When debug is enabled, all loggers set report caller to true #2526

Open
opened 2026-03-01 21:55:49 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/nektos/act/pull/2631
Author: @pcarranza
Created: 1/26/2025
Status: 🔄 Open

Base: masterHead: pc/set-report-caller-on-debug


📝 Commits (1)

  • d846f90 When debug is enabled, all loggers set report caller to true

📊 Changes

2 files changed (+5 additions, -0 deletions)

View changed files

📝 cmd/root.go (+3 -0)
📝 pkg/runner/logger.go (+2 -0)

📄 Description

This change is only to improve debugging visibility by enabling logrus SetReportCaller when the logger is set to debug level (verbose) - Bear in mind that because there's a specific formatter when in text mode, the report caller fields will only be visible in all loggers when the JSON logger is enabled too.

Why this change

This change is a side effect of https://github.com/nektos/act/issues/2609 in which @ChristopherHX challenged that the error of not showing why this is happening belongs to Gitea Act runner and not Nektos Act. I think he's right, but because of how thin the logging is it is tough to understand where the error is being reported, hence I introduced this change (disabled by default in normal operations) to simplify the work of debugging by dumping which line is the one called when something is being logged.

Logs look like this when this is enabled:

{"file":"/home/pcarranza/go/src/github.com/pcarranza/act/pkg/container/docker_socket.go:63","func":"github.com/nektos/act/pkg/container.GetSocketAndHost","level":"debug","msg":"Handling container host and socket","time":"2025-01-26T12:31:33+01:00"}
{"file":"/home/pcarranza/go/src/github.com/pcarranza/act/pkg/container/docker_socket.go:99","func":"github.com/nektos/act/pkg/container.GetSocketAndHost","level":"debug","msg":"Defaulting container socket to DOCKER_HOST","time":"2025-01-26T12:31:33+01:00"}

Then

{"dryrun":false,"file":"/home/pcarranza/go/src/github.com/pcarranza/act/pkg/common/executor.go:38","func":"github.com/nektos/act/pkg/container.(*containerReference).Exec.NewInfoExecutor.func1","job":"testing/monolith","jobID":"monolith","level":"info","matrix":{},"msg":"  🐳  docker exec cmd=[/opt/acttoolcache/node/18.20.5/x64/bin/node /var/run/act/actions/docker-login-action@v3/dist/index.js] user= workdir=","stage":"Main","step":"Login to GitLab Registry","stepID":["0"],"time":"2025-01-26T12:31:38+01:00"}

Greatly simplifying following what is being called when from where.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/nektos/act/pull/2631 **Author:** [@pcarranza](https://github.com/pcarranza) **Created:** 1/26/2025 **Status:** 🔄 Open **Base:** `master` ← **Head:** `pc/set-report-caller-on-debug` --- ### 📝 Commits (1) - [`d846f90`](https://github.com/nektos/act/commit/d846f908eb88a114fb3f66623e9ba77dad31b6ac) When debug is enabled, all loggers set report caller to true ### 📊 Changes **2 files changed** (+5 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `cmd/root.go` (+3 -0) 📝 `pkg/runner/logger.go` (+2 -0) </details> ### 📄 Description This change is only to improve debugging visibility by enabling logrus `SetReportCaller` when the logger is set to debug level (verbose) - Bear in mind that because there's a specific formatter when in text mode, the report caller fields will only be visible in all loggers when the JSON logger is enabled too. ## Why this change This change is a side effect of https://github.com/nektos/act/issues/2609 in which @ChristopherHX challenged that the error of not showing why this is happening belongs to Gitea Act runner and not Nektos Act. I think he's right, but because of how thin the logging is it is tough to understand where the error is being reported, hence I introduced this change (disabled by default in normal operations) to simplify the work of debugging by dumping which line is the one called when something is being logged. Logs look like this when this is enabled: ```json {"file":"/home/pcarranza/go/src/github.com/pcarranza/act/pkg/container/docker_socket.go:63","func":"github.com/nektos/act/pkg/container.GetSocketAndHost","level":"debug","msg":"Handling container host and socket","time":"2025-01-26T12:31:33+01:00"} {"file":"/home/pcarranza/go/src/github.com/pcarranza/act/pkg/container/docker_socket.go:99","func":"github.com/nektos/act/pkg/container.GetSocketAndHost","level":"debug","msg":"Defaulting container socket to DOCKER_HOST","time":"2025-01-26T12:31:33+01:00"} ``` Then ```json {"dryrun":false,"file":"/home/pcarranza/go/src/github.com/pcarranza/act/pkg/common/executor.go:38","func":"github.com/nektos/act/pkg/container.(*containerReference).Exec.NewInfoExecutor.func1","job":"testing/monolith","jobID":"monolith","level":"info","matrix":{},"msg":" 🐳 docker exec cmd=[/opt/acttoolcache/node/18.20.5/x64/bin/node /var/run/act/actions/docker-login-action@v3/dist/index.js] user= workdir=","stage":"Main","step":"Login to GitLab Registry","stepID":["0"],"time":"2025-01-26T12:31:38+01:00"} ``` Greatly simplifying following what is being called when from where. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#2526
No description provided.