action #92902
closedRemove unnecessary linebreaks in cache service logging
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
Updated by tinita over 3 years ago
- Related to action #91527: Cleanup logging in autoinst-log.txt added
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.
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.
Updated by okurz over 2 years ago
- Related to action #94030: Cleanup logging in autoinst-log.txt for download assets added