RESOLVED FIXED 230725
Add flag to enabling release log and implement stderr logging by default
https://bugs.webkit.org/show_bug.cgi?id=230725
Summary Add flag to enabling release log and implement stderr logging by default
Basuke Suzuki
Reported 2021-09-23 15:21:10 PDT
Even if there's no modern logging system, dumping out those logs to stdout/stderr helps a lot on development.
Attachments
PATCH (4.66 KB, patch)
2021-09-29 14:01 PDT, Basuke Suzuki
ews-feeder: commit-queue-
PATCH (12.61 KB, patch)
2021-09-30 18:07 PDT, Basuke Suzuki
ews-feeder: commit-queue-
PATCH (11.48 KB, patch)
2021-10-01 12:06 PDT, Basuke Suzuki
no flags
PATCH (14.42 KB, patch)
2021-10-01 12:32 PDT, Basuke Suzuki
no flags
Basuke Suzuki
Comment 1 2021-09-29 14:01:00 PDT
Radar WebKit Bug Importer
Comment 2 2021-09-30 15:22:15 PDT
Basuke Suzuki
Comment 3 2021-09-30 18:07:21 PDT
Fujii Hironori
Comment 4 2021-09-30 22:31:50 PDT
Comment on attachment 439808 [details] PATCH View in context: https://bugs.webkit.org/attachment.cgi?id=439808&action=review > Source/WTF/wtf/Assertions.h:604 > +#define RELEASE_LOG_FP stdout It's not a good idea to output logs to stdout. It breaks command line application, DumpRenderTree and WebKitTestRunner. > Source/WTF/wtf/Assertions.h:606 > +#define RELEASE_LOG_FP stderr Why do you need LOG_STDERR? WebKit logs are output to stderr. You can enable all log channels by setting log env vars "all". > Source/WTF/wtf/Logger.h:354 > sd_journal_send_with_location(fileString.utf8().data(), lineString.utf8().data(), function, "WEBKIT_SUBSYSTEM=%s", channel.subsystem, "WEBKIT_CHANNEL=%s", channel.name, "MESSAGE=%s", logMessage.utf8().data(), nullptr); What about the idea implementing a compatible sd_journal_send_with_location for your platform.
Basuke Suzuki
Comment 5 2021-09-30 23:52:24 PDT
> It's not a good idea to output logs to stdout. It breaks command line > application, DumpRenderTree and WebKitTestRunner. Well, I don't actually need stdout logging, but I thought it's nice to have option. About the DRT/WTR, stderr output also breaks the test result, doesn't it? We can run tests by building different binary for testing. > Why do you need LOG_STDERR? WebKit logs are output to stderr. You can enable > all log channels by setting log env vars "all". I don't understand that. I need release log and that is disable without enabling os_log or jounald. > What about the idea implementing a compatible sd_journal_send_with_location > for your platform. That was just too much for simple logging with stderr. Those extra info will be dump out when verbose logging.
Fujii Hironori
Comment 6 2021-10-01 00:48:46 PDT
(In reply to Basuke Suzuki from comment #5) > Well, I don't actually need stdout logging, but I thought it's nice to have > option. About the DRT/WTR, stderr output also breaks the test result, > doesn't it? We can run tests by building different binary for testing. The loggs in stderr don't make the test fail. But, if a test fail, run-webkit-tests show the stderr for the hint of debugging. For example, in the following test result, http/tests/xmlhttprequest/onload-progressevent-attributes.html failed and had a stderr message. https://build.webkit.org/results/WinCairo-64-bit-WKL-Release-Tests/r282824%20(2701)/results.html > > Why do you need LOG_STDERR? WebKit logs are output to stderr. You can enable > > all log channels by setting log env vars "all". > > I don't understand that. I need release log and that is disable without > enabling os_log or jounald. Oh, I misunderstood. > > What about the idea implementing a compatible sd_journal_send_with_location > > for your platform. > > That was just too much for simple logging with stderr. Those extra info will > be dump out when verbose logging. Got it.
Fujii Hironori
Comment 7 2021-10-01 00:50:25 PDT
Comment on attachment 439808 [details] PATCH View in context: https://bugs.webkit.org/attachment.cgi?id=439808&action=review > ChangeLog:3 > + [PlayStation] Enable release logging to stdout or stderr This patch is almost platform independent change. Darin asked me not to use the platform prefix for such platform independent changes, for example [PlayStation] and [WinCairo].
Fujii Hironori
Comment 8 2021-10-01 01:03:08 PDT
How do you think an idea always enabling RELEASE_LOG, and if USE(OS_LOG) and USE(JOURNALD) are not true, use stderr.
Michael Catanzaro
Comment 9 2021-10-01 06:07:36 PDT
(In reply to Fujii Hironori from comment #8) > How do you think an idea always enabling RELEASE_LOG, and if USE(OS_LOG) and > USE(JOURNALD) are not true, use stderr. That sounds good to me. Will result in simpler #if #elifs too. The logs are all disabled by default anyway: you need to opt-in using a confusing environment variable that I can never figure out how to use.
Michael Catanzaro
Comment 10 2021-10-01 06:09:17 PDT
Comment on attachment 439808 [details] PATCH View in context: https://bugs.webkit.org/attachment.cgi?id=439808&action=review > Source/WTF/wtf/Assertions.h:600 > +#error "Cannot unable both USE_LOG_STDOUT and USE_LOG_STDERR" "Cannot use both" >> Source/WTF/wtf/Logger.h:354 >> sd_journal_send_with_location(fileString.utf8().data(), lineString.utf8().data(), function, "WEBKIT_SUBSYSTEM=%s", channel.subsystem, "WEBKIT_CHANNEL=%s", channel.name, "MESSAGE=%s", logMessage.utf8().data(), nullptr); > > What about the idea implementing a compatible sd_journal_send_with_location for your platform. Seems like overkill?
Basuke Suzuki
Comment 11 2021-10-01 08:36:26 PDT
(In reply to Fujii Hironori from comment #6) > The loggs in stderr don't make the test fail. But, if a test fail, > run-webkit-tests show the stderr for the hint of debugging. > For example, in the following test result, > http/tests/xmlhttprequest/onload-progressevent-attributes.html failed and > had a stderr message. > https://build.webkit.org/results/WinCairo-64-bit-WKL-Release-Tests/ > r282824%20(2701)/results.html Ah, make sense. That was one of my use case to use stdout so I agree to remove it for simplicity.
Basuke Suzuki
Comment 12 2021-10-01 08:38:14 PDT
Comment on attachment 439808 [details] PATCH View in context: https://bugs.webkit.org/attachment.cgi?id=439808&action=review >> ChangeLog:3 >> + [PlayStation] Enable release logging to stdout or stderr > > This patch is almost platform independent change. Darin asked me not to use the platform prefix for such platform independent changes, for example [PlayStation] and [WinCairo]. Right. Will remove the prefix. >> Source/WTF/wtf/Assertions.h:600 >> +#error "Cannot unable both USE_LOG_STDOUT and USE_LOG_STDERR" > > "Cannot use both" Thanks.
Basuke Suzuki
Comment 13 2021-10-01 08:53:09 PDT
(In reply to Michael Catanzaro from comment #9) > (In reply to Fujii Hironori from comment #8) > > How do you think an idea always enabling RELEASE_LOG, and if USE(OS_LOG) and > > USE(JOURNALD) are not true, use stderr. > > That sounds good to me. Will result in simpler #if #elifs too. The logs are > all disabled by default anyway: you need to opt-in using a confusing > environment variable that I can never figure out how to use. That is kind of a big change for default configuration. There's tons of code omitted from runtime binary when not RELEASE_LOG_DISABLED. They are just there sitting silently without doing almost nothing. If we do this change, we should introduce ENABLE_RELEASE_LOG as other features do and make it completely opt-in feature. At that time, I agree with the default choice of logging. How about this?
Michael Catanzaro
Comment 14 2021-10-01 09:17:40 PDT
I assumed it would not print anything unless special environment variables are enabled. I agree it should not print to stderr by default.
Basuke Suzuki
Comment 15 2021-10-01 12:06:36 PDT
Basuke Suzuki
Comment 16 2021-10-01 12:32:16 PDT
Basuke Suzuki
Comment 17 2021-10-01 12:35:57 PDT
This is the shape including the points you guys reviewed. Removing USE_LOG_STDERR and added global flag ENABLE_RELEASE_LOG. Actual checking in the entire code base is untouched, still RELEASE_LOG_DISABLED is used. ENABLE_RELEASE_LOG is used to define that value at the beginning of Assertions.h.
Michael Catanzaro
Comment 18 2021-10-03 08:23:05 PDT
Comment on attachment 439898 [details] PATCH A follow-up patch could replace RELEASE_LOG_DISABLED with ENABLE(RELEASE_LOG).
Basuke Suzuki
Comment 19 2021-10-03 09:40:42 PDT
Comment on attachment 439898 [details] PATCH Thanks. I'll create a ticket for that.
EWS
Comment 20 2021-10-03 10:20:07 PDT
Committed r283469 (242446@main): <https://commits.webkit.org/242446@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 439898 [details].
Note You need to log in before you can comment on or make changes to this bug.