// Sets the minimum log level. Valid values are from 0 to 3: // INFO = 0, WARNING = 1, LOG_ERROR = 2, LOG_FATAL = 3. const char kLoggingLevel[] = "log-level";
// The verbose logging can also be turned on module-by-module. For instance, // --vmodule=profile=2,icon_loader=1,browser_*=3,*/chromeos/*=4 --v=0 // will cause: // a. VLOG(2) and lower messages to be printed from profile.{h,cc} // b. VLOG(1) and lower messages to be printed from icon_loader.{h,cc} // c. VLOG(3) and lower messages to be printed from files prefixed with // "browser" // d. VLOG(4) and lower messages to be printed from files under a // "chromeos" directory. // e. VLOG(0) and lower messages to be printed from elsewhere // // The wildcarding functionality shown by (c) supports both '*' (match // 0 or more characters) and '?' (match any single character) // wildcards. Any pattern containing a forward or backward slash will // be tested against the whole pathname and not just the module. // E.g., "*/foo/bar/*=2" would change the logging level for all code // in source files under a "foo/bar" directory. // // Note that for a Chromium binary built in release mode (is_debug = false) you // must pass "--enable-logging=stderr" in order to see the output of VLOG // statements.
比如:设置trace跟踪,也可以用chrome://tracing
out\Default\chrome1.exe --enable-skia-benchmarking --enable-gpu-benchmarking --no-sandbox --process-per-site --remote-debugging-port=9222 --enable-logging --v=2 --trace-startup=cc --trace-startup-file=d:\\chrometrace.log
How to enable logging
To enable logging, launch Chrome with these command line flags:
--enable-logging=stderr --v=1 # Output will be printed to standard error (eg. printed in the console) and to the debugger
--enable-logging=stderr --v=1
> log.txt 2>&1 # Capture stderr and stdout to a log file
Note that:
How do I specify the command line flags?
See
command line flags page.
What personal information does the log file contain?
Before attaching your
chrome_debug.log to a bug report, be aware that it can contain some personal information, such as URLs opened during that session of chrome.
Since the debug log is a human-readable text file, you can open it up with a text editor (notepad, vim, etc..) and review the information it contains, and erase anything you don't want the bug investigators to see.
The boilerplate values enclosed by brackets on each line are in the format:
[process_id:thread_id:ticks_in_microseconds:log_level:file_name(line_number)]
Alternatively to the above, you can use the Sawbuck utility (for Windows) to view, filter and search the logs in realtime, in a handy-dandy GUI.
First download and install the latest version of
Sawbuck, launch it, then select "Configure Providers.." form the "Log" menu.
This will bring up a dialog that looks something like this:
Set the log level for Chrome, Chrome Frame, and/or the Setup program to whatever suits you, and click "OK". You can revisit this dialog at any time to increase or decrease the log verbosity.
Now select "Capture" from the "Log" menu, and you should start seeing Chrome's log messages.
Note that Sawbuck has a feature that allows you to view the call trace for each log message, which can come in handy when you're trying to home in on a particular problem.
Note for 64-bit Chrome: Reporting of callstacks, source file, and line info does not currently work when originating from 64-bit Chrome, and log messages will be garbage by default (
https://crbug.com/456884). Change the "Enable Mask" for the Chrome and Chrome Setup providers so that "Text Only" is the only option selected to have non-garbaled log messages.
|
Run Chromium with flags
There are command line flags (or "switches") that Chromium (and Chrome) accept in order to enable particular features or modify otherwise default functionality. Current switches may be found at http://peter.sh/examples/?/chromium-switches.html It is important to note that some switches are intended for temporary cases and may break in the future. Note that if you look at Windows
macOS
Linux
V8 FlagsV8 can take a number of flags as well, via Chrome's chrome.exe --js-flags="--trace-opt --trace-deopt --trace-bailout"
To get a listing of all possible V8 flags: chrome.exe --js-flags="--help"
Browse the V8 wiki for more flags for V8. AndroidVisit ' If you are running on a rooted device or using a debug build of Chromium, then you can set flags like so: out/Default/bin/chrome_public_apk argv # Show existing flags.
You can also install, set flags, and launch with a single command: out/Default/bin/chrome_public_apk run --args='--foo --bar'
For production build on a non-rooted device, you need to enable "Enable command line on non-rooted devices" in chrome://flags, then set command line in /data/local/tmp/chrome-command-line. When doing that, mind that the first command line item should be a "_" (underscore) followed by the ones you actually need. Finally, manually restart Chrome ("Relaunch" from chrome://flags page might no be enough to trigger reading this file). See https://crbug.com/784947. ContentShell on AndroidThere's an alternative method for setting flags with ContentShell that doesn't require building yourself:
adb shell am start \
-a android.intent.action.VIEW \
-n org.chromium.content_shell_apk/.ContentShellActivity \
--es activeUrl "http://chromium.org" \
--esa commandLineArgs --show-paint-rects,--show-property-changed-rects
This will launch contentshell with the supplied flags. You can apply whatever commandLineArgs you want in that syntax. Android WebViewThis is documented in the chromium tree. Chrome OS
|