Child processes on Windows cannot always open their log file
(for instance if they cannot determine the user-data-dir) making
configuration of logging complicated. Child processes also need
a sandbox exception to open their log files.
This CL replaces logging related flags to pass a handle to children
in cases where a file would have been passed, allowing a later CL
to remove the sandbox rule allowing direct access to the log file.
If the browser is run with `--enable-logging --log-file=file`,
children will now be run with `--enable-logging=handle --log-file=N`.
It is not possible to mix stderr logging with file logging (it will
still work for the browser process), but this already does not work
in official builds as std handles are not passed into children.
This also allows the CHROME_LOG_FILE to be useful again for renderer
processes if Chrome is run using:
$env:CHROME_LOG_FILE="d:\temp\env-log.log"
chrome.exe --enable-logging
the browser will inspect the env var and provide a handle to that
file when starting renderer processes.
Running the browser with --enable-logging=handle directly is not
supported, these flags should only be provided by the browser when
starting child processes.
Tests: Manually tested results https://docs.google.com/document/d/1Hq37YReGM91fmcCcqkRbjtjwP62FVH_zpZtfpSPlLeY/edit?usp=sharing
Bug: 328285906, 40270808
Change-Id: Id79731b2d35ab3ee58f6c1612990bdec1485da68
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5337202
Commit-Queue: Alex Gough <ajgo@chromium.org>
Reviewed-by: Greg Thompson <grt@chromium.org>
Reviewed-by: Peter Boström <pbos@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1272538}