Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging improvements #399

Merged
merged 6 commits into from
Oct 31, 2024
Merged

Logging improvements #399

merged 6 commits into from
Oct 31, 2024

Conversation

locker
Copy link
Member

@locker locker commented Oct 29, 2024

The goal of this PR is to fix spamming stdout on test failure with unified logging is enabled. Apart from that, it also brings a few improvements to unified logging.

Close #382

Unified logging is a fetaure that enables writing logs emitted by all
server instances instances and the luatest runner itself to a single
file. It's implemented by duplicating logs to stdout (using the tee
Linux command) and piping stdout to a log file in OutputBeautifier.
The OutputBeautifier still writes the logs to stdout, even if unified
logging is enabled. As a result, on any failure the runner spams stdout
with captured logs of started server instances. There's no need for
that because all logs can be read from the unified log file. It only
clutters the output making it difficult to figure out what went wrong.
So let's disable writing to stdout in OutputBeautifier if unified
logging is enabled.

No changelog because the feature was added by commit f8a1c10
("Add logging to unified file"), which hasn't been released yet.

Closes tarantool#382
This is ugly. Instead, let's redirect logs directly to the pipe
created by the OutputBeautifier.

No changelog because the feature was added by commit f8a1c10
("Add logging to unified file"), which hasn't been released yet.
In the scope of unified logging, new options -vv and -vvv were
introduced. They set the luatest log level to VERBOSE and DEBUG,
respectively. Actually, there's no need to suppress any logging
because it goes to a file and doesn't spam the output. Besides,
it's ugly that we mix luatest logging with luatest output verbosity.
Let's drop the levels and use log.info instead of log.verbose or
log.debug everywhere in luatest.

No changelog because the feature was added by commit f8a1c10
("Add logging to unified file"), which hasn't been released yet.
 * Log all assertions, not just a few select ones.
 * Don't log assertion arguments because that would be too verbose.
   Instead, log only the file and the line where the assertion is
   checked. It should be enough for debugging.
 * Log where helpers.retrying is called. Also, fix formatting of
   fractional seconds.
 * Log test errors and failures so that one can figure out where
   the test failed by just looking at the unified log, without
   the luatest output.

No changelog because the feature was added by commit d985997
("Add more logs"), which hasn't been released yet.
This is bad because it quotes all strings although most of the times we
don't need it. This also makes `luatest.log` work differently from the
built-in logger while we want them to be interchangeable.

We don't need pretty-printing anymore because we don't log assertion
arguments. If the caller needs pretty-printing, they can do it manually.

This effectively reverts commit 15dbf75 ("Improve luatest.log
function if a nil value is passed") and a good part of commit
a005329 ("Add syntax sugar for more convenient logging").
Now, that auto-quoting is disabled in the log, let's quote server names
and conditions because without quoting they look ugly.

No changelog as this is a minor change related to the previous commit.
Copy link
Member

@Totktonada Totktonada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understood the changes right, after the patch we have the following situation: we have -c to see extra logs (child processes output, invoked assertions) and -l to write them to the file. The default is to drop these extra logs. It should be convenient, I think.

I'm not in context of the work that was done for unified logging before, so my review is not deep. However, the proposed patches look meaningful for me.

@Totktonada Totktonada removed their assignment Oct 31, 2024
@locker locker merged commit 7dc5cb7 into tarantool:master Oct 31, 2024
9 checks passed
@locker locker deleted the logging-improvements branch October 31, 2024 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

reduce, refactor logs
2 participants