Project

General

Profile

Actions

action #92902

closed

Remove unnecessary linebreaks in cache service logging

Added by tinita over 3 years ago. Updated over 2 years ago.

Status:
Resolved
Priority:
Low
Assignee:
Category:
Regressions/Crashes
Target version:
Start date:
2021-05-20
Due date:
% Done:

0%

Estimated time:

Description

Motivation

I was wondering about the additional linebreak:

[info] [#70]
Cache size of "/var/lib/openqa/cache" is 21GiB, with limit 180GiB

for example in https://openqa.opensuse.org/tests/1750003/file/autoinst-log.txt:

[2021-05-20T06:08:43.0426 CEST] [info] Download of Tumbleweed.x86_64-1.0-virtualbox-Snapshot20210519.vagrant.virtualbox.box processed:
[info] [#51]
Cache size of "/var/lib/openqa/cache" is 17GiB, with limit 180GiB
[info] [#51]
Downloading "Tumbleweed.x86_64-1.0-virtualbox-Snapshot20210519.vagrant.virtualbox.box" from "http://openqa1-opensuse/tests/1750006/asset/other/Tumbleweed.x86_64-1.0-virtualbox-Snapshot20210519.vagrant.virtualbox.box"
[info] [#51]
Size of "/var/lib/openqa/cache/openqa1-opensuse/Tumbleweed.x86_64-1.0-virtualbox-Snapshot20210519.vagrant.virtualbox.box" is 312MiB, with ETag ""137afea0-5c2b8033306c0""
[info] [#51]
Download of "/var/lib/openqa/cache/openqa1-opensuse/Tumbleweed.x86_64-1.0-virtualbox-Snapshot20210519.vagrant.virtualbox.box" successful, new cache size is 19GiB

I think the linebreak after [info] [#70] comes from a wrong handling of log messages, for example in:

https://github.com/os-autoinst/openQA/blob/master/lib/OpenQA/CacheService/Task/Asset.pm#L50-L54

    $log->on(
        message => sub {
            my ($log, $level, @lines) = @_;
            $output .= "[$level] " . join "\n", @lines, '';
        });

The callback gets [#70] and the actual log message in two lines, so I think the join "\n" should be replaced with join " " here.

It's not really clear from https://metacpan.org/pod/Mojo::Log how multiple arguments to one of the log methods are supposed to behave. But $log->context adds the [#70] as an array item, and I don't think this is supposed to create a new line.

The task is to find out if this is already covered by tests, then change the test, or to add a test.

Acceptance criteria

  • AC1: No newline after the log line prefix

Related issues 2 (0 open2 closed)

Related to openQA Project (public) - action #91527: Cleanup logging in autoinst-log.txtResolvedilausuch2021-04-21

Actions
Related to openQA Project (public) - action #94030: Cleanup logging in autoinst-log.txt for download assetsResolvedokurz2021-06-15

Actions
Actions #1

Updated by tinita over 3 years ago

  • Related to action #91527: Cleanup logging in autoinst-log.txt added
Actions #2

Updated by okurz over 3 years ago

  • Description updated (diff)
Actions #3

Updated by okurz over 2 years ago

  • Status changed from Workable to In Progress
  • Assignee set to okurz
  • Target version changed from future to Ready

Hotpatched openqaworker7 to check.

Actions #4

Updated by okurz over 2 years ago

  • Status changed from In Progress to Resolved

https://github.com/os-autoinst/openQA/pull/4601 merged. Yes, sorry, no good test coverage increase.

Actions #5

Updated by okurz over 2 years ago

  • Related to action #94030: Cleanup logging in autoinst-log.txt for download assets added
Actions

Also available in: Atom PDF