-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Miscellaneous logging improvements #12662
Conversation
Reviewed 1 of 2 files at r1, 1 of 2 files at r2, 2 of 2 files at r3, 2 of 2 files at r4, 3 of 3 files at r5, 1 of 1 files at r6, 1 of 1 files at r7, 3 of 3 files at r8, 25 of 25 files at r9, 3 of 3 files at r10. Comments from Reviewable |
Reviewed 1 of 2 files at r1, 1 of 2 files at r2, 2 of 2 files at r3, 2 of 2 files at r4, 3 of 3 files at r5, 1 of 1 files at r6, 1 of 1 files at r7, 3 of 3 files at r8. pkg/cli/start.go, line 279 at r3 (raw file):
what if pkg/sql/logic_test.go, line 370 at r8 (raw file):
ah I see, this is why you exported LogScope. I think you should combine those two commits, but also extract TestLogScope into its own package that both log_test and sql_test can depend on - then you won't need pkg/sql/logic_test.go, line 397 at r8 (raw file):
pkg/util/log/test_log_scope.go, line 34 at r5 (raw file):
This commit doesn't include any rationale - why did you need to export this stuff? Comments from Reviewable |
Review status: 0 of 37 files reviewed at latest revision, 4 unresolved discussions. pkg/cli/start.go, line 279 at r3 (raw file): Previously, tamird (Tamir Duberstein) wrote…
If the value is non-empty then log.DirSet() returns true. pkg/sql/logic_test.go, line 370 at r8 (raw file): Previously, tamird (Tamir Duberstein) wrote…
There is no I did combine the two subsequent commits though as you suggested. pkg/sql/logic_test.go, line 397 at r8 (raw file): Previously, tamird (Tamir Duberstein) wrote…
Done. Comments from Reviewable |
8eb4653
to
ed8a2d4
Compare
Reviewed 1 of 3 files at r5, 37 of 38 files at r11, 2 of 2 files at r13, 2 of 2 files at r14, 1 of 1 files at r15, 1 of 1 files at r16, 4 of 4 files at r17, 1 of 5 files at r19. pkg/sql/logic_test.go, line 370 at r8 (raw file):
Not true - if you can make them Ah, I guess that's what you tried. Comments from Reviewable |
895bf2d
to
5547306
Compare
…derr Prior to this patch, if a log message was output to stderr (because --logtostderr or --alsologtostderr was set), then it wasn't output to the log files *at all* even if a log directory was available. This patch fixes this behavior by ensuring that log messages are *copied* to stderr (so they also appear in the log files). It also fixes another issue: although the help text for `--log-dir` says that an empty value disables logging to files, this was not honoured. With this patch `--log-dir=""` becomes effective.
Prior to this patch all the server logs were going to stderr, and separately the logic in `testing.T` would capture the test's stderr into an in-memory buffer and reproduce it on the real stderr upon encountering a failing test. This was a nuisance because pasting the entire logging output to the real stderr upon errors was only making the CI log very long and slow to load in browsers for no useful reason -- in most practical cases, when a logic test fails, the cause is in a non-logged part of the SQL code somewhere and not visible in the logs anyway. This patch changes the behavior as follows: - `TestLogic` now uses a `log.TestLogScope` and sets `log.EnableLogFileOutput()`, which causes: - the server logs to be output to files, - the files to be automatically deleted when the test terminates successfully, - the log directory to be reported in the error message when a test error occurs so that the user can go and look at the log files only if they want to. - `TestLogic` now also logs the "important" events of the input test data (new user, SQL queries, etc) both to the logging output (and thus the log files) and the standard output. This way a user who decides to inspect the log file later can still observe the time interleaving of test events and logging messages.
This patch causes acceptance logs to be emitted to files, with only errors (severity ERROR or higher) emitted to stderr. The files are deleted if the test succeeds, but preserved if a test fails and the location of the directory is printed in the test's failure message.
Prior to this patch, GetLogReader would get confused if the logDir wasn't relative to the current directory. This patch ensures that it can handle any path including absolute paths outside of the cwd or relative paths outside of the cwd or logDir.
This patch ensures that more logging output lands into the `artifacts` sub-directory, and also reports detailed tracing of shell script execution.
There is an ongoing issue in TestNodeRestart (chaos_test.go) which causes the Docker library to become very confused in all subsequent tests that also use Docker (i.e. most of them). This patch works around the issue (without solving it) by ensuring that TestNodeRestart runs last.
Just noticed this: |
Review status: 0 of 43 files reviewed at latest revision, 2 unresolved discussions. pkg/util/log/trace_test.go, line 95 at r26 (raw file):
I believe this is funky. First of all, this is an atomic, and it has a setter. Second, I think it should be restored when the test is done. Third, I think modifying that global is generally horrible because... it's a global (think parallel tests). I'm curious what motivated this change exactly. What did we want to keep out of stderr? If I run with Comments from Reviewable |
Review status: 0 of 43 files reviewed at latest revision, 2 unresolved discussions. pkg/util/log/trace_test.go, line 95 at r26 (raw file): Previously, andreimatei (Andrei Matei) wrote…
Thank you for taking the time to review this, albeit late. Since the PR is already merged it makes it hard(er) to have a discussion and iterate on code. Mind copy-pasting your concern into a new issue and assign it to me? (I would rather you do that in general in the future if you want to comment on closed PRs.) Comments from Reviewable |
Review status: 0 of 43 files reviewed at latest revision, 2 unresolved discussions. pkg/util/log/trace_test.go, line 95 at r26 (raw file): Previously, knz (kena) wrote…
Filed #16551 Comments from Reviewable |
The main visible changes here are:
make acceptance
now capture all generated temp files, including temp files and thus non-redirected log files, in the artifact directory.--log-dir=""
can now disable output to files as advertisedThis change is