configuration setting log.level has no effect (always logging at DEBUG level) #409

Open
opened 2023-11-22 22:36:39 +00:00 by nodiscc · 2 comments

Lowering the log level to warn in the configuration file has no effect, [DEBUG] messages and job logs are still being logged to stdout/journald/syslog:

# /etc/act-runner/config.yaml
log:
  level: warn
$ sudo systemctl restart act-runner
# run a job from gitea's web interface
$ grep act-runner /var/log/syslog
Nov 22 23:27:46 home systemd[1]: Stopping act-runner.service - Gitea Actions runner...
Nov 22 23:27:46 home systemd[1]: act-runner.service: Deactivated successfully.
Nov 22 23:27:46 home systemd[1]: Stopped act-runner.service - Gitea Actions runner.
Nov 22 23:27:46 home systemd[1]: act-runner.service: Consumed 1.365s CPU time.
Nov 22 23:27:46 home systemd[1]: Started act-runner.service - Gitea Actions runner.
Nov 22 23:27:46 home act-runner[916192]: time="2023-11-22T23:27:46+01:00" level=info msg="log level changed to warning"
Nov 22 23:27:47 home act-runner[916192]: time="2023-11-22T23:27:47+01:00" level=warning msg="Because the Gitea instance is an old version, skip declare labels and version."
Nov 22 23:28:02 home act-runner[916192]: [CI/check-and-deploy] [DEBUG] evaluating expression 'success()'
Nov 22 23:28:02 home act-runner[916192]: [CI/check-and-deploy] [DEBUG] expression 'success()' evaluated to 'true'
Nov 22 23:28:02 home act-runner[916192]: [CI/check-and-deploy] 🚀  Start image=node:16-bullseye
Nov 22 23:28:02 home act-runner[916192]: [CI/check-and-deploy]   🐳  docker pull image=node:16-bullseye platform= username= forcePull=false
Nov 22 23:28:02 home act-runner[916192]: [CI/check-and-deploy] [DEBUG]   🐳  docker pull node:16-bullseye
Nov 22 23:28:02 home act-runner[916192]: [CI/check-and-deploy] [DEBUG] Image exists? true
....
....
Nov 22 23:29:56 home act-runner[916192]: [CI/check-and-deploy] [DEBUG] Working directory '/var/lib/act-runner/.cache/act/example/example'
Nov 22 23:29:57 home act-runner[916192]: [CI/check-and-deploy]   |
Nov 22 23:29:57 home act-runner[916192]: [CI/check-and-deploy]   | WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Nov 22 23:29:57 home act-runner[916192]: [CI/check-and-deploy]   |
Nov 22 23:29:58 home act-runner[916192]: [CI/check-and-deploy]   | Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB]
Nov 22 23:29:59 home act-runner[916192]: [CI/check-and-deploy]   | Get:2 http://deb.debian.org/debian-security bullseye-security InRelease [48.4 kB]
Nov 22 23:30:00 home act-runner[916192]: [CI/check-and-deploy]   | Get:3 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]
Nov 22 23:30:01 home act-runner[916192]: [CI/check-and-deploy]   | Get:4 http://deb.debian.org/debian bullseye/main amd64 Packages [8062 kB]
Nov 22 23:30:02 home act-runner[916192]: [CI/check-and-deploy]   | Get:5 http://deb.debian.org/debian-security bullseye-security/main amd64 Packages [258 kB]
Nov 22 23:30:02 home act-runner[916192]: [CI/check-and-deploy]   | Get:6 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [17.7 kB]
Nov 22 23:30:03 home act-runner[916192]: [CI/check-and-deploy]   | Fetched 8546 kB in 5s (1589 kB/s)
Nov 22 23:30:03 home act-runner[916192]: [CI/check-and-deploy]   | Reading package lists...
Nov 22 23:30:04 home act-runner[916192]: [CI/check-and-deploy]   | Building dependency tree...
Nov 22 23:30:04 home act-runner[916192]: [CI/check-and-deploy]   | Reading state information...
Nov 22 23:30:04 home act-runner[916192]: [CI/check-and-deploy]   | 50 packages can be upgraded. Run 'apt list --upgradable' to see them.
Nov 22 23:30:04 home act-runner[916192]: [CI/check-and-deploy]   |
Nov 22 23:30:04 home act-runner[916192]: [CI/check-and-deploy]   | WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Nov 22 23:30:04 home act-runner[916192]: [CI/check-and-deploy]   |
Nov 22 23:30:04 home act-runner[916192]: [CI/check-and-deploy]   | Reading package lists...
...

act_runner v0.2.6

Lowering the log level to `warn` in the configuration file has no effect, `[DEBUG]` messages and job logs are still being logged to stdout/journald/syslog: ```yaml # /etc/act-runner/config.yaml log: level: warn ``` ```bash $ sudo systemctl restart act-runner # run a job from gitea's web interface ``` ``` $ grep act-runner /var/log/syslog Nov 22 23:27:46 home systemd[1]: Stopping act-runner.service - Gitea Actions runner... Nov 22 23:27:46 home systemd[1]: act-runner.service: Deactivated successfully. Nov 22 23:27:46 home systemd[1]: Stopped act-runner.service - Gitea Actions runner. Nov 22 23:27:46 home systemd[1]: act-runner.service: Consumed 1.365s CPU time. Nov 22 23:27:46 home systemd[1]: Started act-runner.service - Gitea Actions runner. Nov 22 23:27:46 home act-runner[916192]: time="2023-11-22T23:27:46+01:00" level=info msg="log level changed to warning" Nov 22 23:27:47 home act-runner[916192]: time="2023-11-22T23:27:47+01:00" level=warning msg="Because the Gitea instance is an old version, skip declare labels and version." Nov 22 23:28:02 home act-runner[916192]: [CI/check-and-deploy] [DEBUG] evaluating expression 'success()' Nov 22 23:28:02 home act-runner[916192]: [CI/check-and-deploy] [DEBUG] expression 'success()' evaluated to 'true' Nov 22 23:28:02 home act-runner[916192]: [CI/check-and-deploy] 🚀 Start image=node:16-bullseye Nov 22 23:28:02 home act-runner[916192]: [CI/check-and-deploy] 🐳 docker pull image=node:16-bullseye platform= username= forcePull=false Nov 22 23:28:02 home act-runner[916192]: [CI/check-and-deploy] [DEBUG] 🐳 docker pull node:16-bullseye Nov 22 23:28:02 home act-runner[916192]: [CI/check-and-deploy] [DEBUG] Image exists? true .... .... Nov 22 23:29:56 home act-runner[916192]: [CI/check-and-deploy] [DEBUG] Working directory '/var/lib/act-runner/.cache/act/example/example' Nov 22 23:29:57 home act-runner[916192]: [CI/check-and-deploy] | Nov 22 23:29:57 home act-runner[916192]: [CI/check-and-deploy] | WARNING: apt does not have a stable CLI interface. Use with caution in scripts. Nov 22 23:29:57 home act-runner[916192]: [CI/check-and-deploy] | Nov 22 23:29:58 home act-runner[916192]: [CI/check-and-deploy] | Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB] Nov 22 23:29:59 home act-runner[916192]: [CI/check-and-deploy] | Get:2 http://deb.debian.org/debian-security bullseye-security InRelease [48.4 kB] Nov 22 23:30:00 home act-runner[916192]: [CI/check-and-deploy] | Get:3 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB] Nov 22 23:30:01 home act-runner[916192]: [CI/check-and-deploy] | Get:4 http://deb.debian.org/debian bullseye/main amd64 Packages [8062 kB] Nov 22 23:30:02 home act-runner[916192]: [CI/check-and-deploy] | Get:5 http://deb.debian.org/debian-security bullseye-security/main amd64 Packages [258 kB] Nov 22 23:30:02 home act-runner[916192]: [CI/check-and-deploy] | Get:6 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [17.7 kB] Nov 22 23:30:03 home act-runner[916192]: [CI/check-and-deploy] | Fetched 8546 kB in 5s (1589 kB/s) Nov 22 23:30:03 home act-runner[916192]: [CI/check-and-deploy] | Reading package lists... Nov 22 23:30:04 home act-runner[916192]: [CI/check-and-deploy] | Building dependency tree... Nov 22 23:30:04 home act-runner[916192]: [CI/check-and-deploy] | Reading state information... Nov 22 23:30:04 home act-runner[916192]: [CI/check-and-deploy] | 50 packages can be upgraded. Run 'apt list --upgradable' to see them. Nov 22 23:30:04 home act-runner[916192]: [CI/check-and-deploy] | Nov 22 23:30:04 home act-runner[916192]: [CI/check-and-deploy] | WARNING: apt does not have a stable CLI interface. Use with caution in scripts. Nov 22 23:30:04 home act-runner[916192]: [CI/check-and-deploy] | Nov 22 23:30:04 home act-runner[916192]: [CI/check-and-deploy] | Reading package lists... ... ``` act_runner v0.2.6
lng2020 added the
kind
bug
label 2023-11-23 06:23:34 +00:00
Author

Hi,

any updates on this?

I have deployed act-runner as a systemd service and it is spamming syslog with all messages from the build output. The log is not even useful as output of all jobs are mangled together.

I could try to patch it but have no idea where to begin. Is this hard to fix?

Hi, any updates on this? I have deployed act-runner as a systemd service and it is spamming syslog with all messages from the build output. The log is not even useful as output of all jobs are mangled together. I could try to patch it but have no idea where to begin. Is this hard to fix?

This seems to be the reason - if JobLoggerLevel in runner config is nil, trace level is set:

gitea.com\gitea\act@v0.251.1\pkg\runner\logger.go
func WithJobLogger(ctx context.Context, jobID string, jobName string, config *Config, masks *[]string, matrix map[string]interface{}) context.Context {
...
	{ // Adapt to Gitea
		if hook := common.LoggerHook(ctx); hook != nil {
			logger.AddHook(hook)
		}
		if config.JobLoggerLevel != nil {
			logger.SetLevel(*config.JobLoggerLevel)
		} else {
			logger.SetLevel(logrus.TraceLevel)
		}
	}

Seems like JobLoggerLevel isn't set when initializing plan executor:

internal\app\run\runner.go
	executor := rr.NewPlanExecutor(plan)


gitea.com\gitea\act@v0.251.1\pkg\runner\runner.go
func (runner *runnerImpl) NewPlanExecutor(plan *model.Plan) common.Executor {
...
						return executor(common.WithJobErrorContainer(WithJobLogger(ctx, rc.Run.JobID, jobName, rc.Config, &rc.Masks, matrix)))
This seems to be the reason - if JobLoggerLevel in runner config is nil, trace level is set: ``` gitea.com\gitea\act@v0.251.1\pkg\runner\logger.go func WithJobLogger(ctx context.Context, jobID string, jobName string, config *Config, masks *[]string, matrix map[string]interface{}) context.Context { ... { // Adapt to Gitea if hook := common.LoggerHook(ctx); hook != nil { logger.AddHook(hook) } if config.JobLoggerLevel != nil { logger.SetLevel(*config.JobLoggerLevel) } else { logger.SetLevel(logrus.TraceLevel) } } ``` Seems like JobLoggerLevel isn't set when initializing plan executor: ``` internal\app\run\runner.go executor := rr.NewPlanExecutor(plan) gitea.com\gitea\act@v0.251.1\pkg\runner\runner.go func (runner *runnerImpl) NewPlanExecutor(plan *model.Plan) common.Executor { ... return executor(common.WithJobErrorContainer(WithJobLogger(ctx, rc.Run.JobID, jobName, rc.Config, &rc.Masks, matrix))) ```
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
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: gitea/act_runner#409
No description provided.