Project

General

Profile

action #92902

Remove unnecessary linebreaks in cache service logging

Added by tinita 2 months ago. Updated 2 months ago.

Status:
Workable
Priority:
Low
Assignee:
-
Category:
Concrete Bugs
Target version:
Start date:
2021-05-20
Due date:
% Done:

0%

Estimated time:
Difficulty:

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

Related to openQA Project - action #91527: Cleanup logging in autoinst-log.txtResolved2021-04-21

History

#1 Updated by tinita 2 months ago

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

#2 Updated by okurz 2 months ago

  • Description updated (diff)

Also available in: Atom PDF