The Chromium Projects

Except as otherwise noted, the content of this page is licensed under a Creative Commons Attribution 2.5 license, and examples are licensed under the BSD License.

The Chromium OS designs and code are preliminary. Expect them to evolve.
For Testers‎ > ‎

How to enable logging

To enable logging, launch Chrome with these command line flags:

  --enable-logging --log-level=0
  • This will turn on full logging support (INFO, WARNING, ERROR).
  • The output will be saved to the file chrome_debug.log in Chrome's user data directory (in the parent directory of Default/).
  • This file is overwritten each time you restart chrome.
Note that:
  • The location of Chrome's user data directory depends on your operating system, and whether you are using Chrome vs Chromium.
  • The above document lists the path to the Default/ directory; the chrome_debug.log file we are interested in is actually one directory above this (i.e. the parent directory)
  • If the environment variable CHROME_LOG_FILE is set, Chrome will write its debug log to its specified location.  Example: Setting CHROME_LOG_FILE to "chrome_debug.log" will cause the log file to be written to the Chrome process's current working directory while setting it to "D:\chrome_debug.log" will write the log to the root of your computer's D: drive.
  • To override the log file path in a test harness that runs Chrome, use this pattern:
    #include "chrome/common/env_vars.h"
    ...
    // Set the log file path in the environment for the test browser.
    std::wstring log_file_path = ...;
    SetEnvironmentVariable(env_vars::kLogFileName, log_file_path.c_str());

How do I specify the command line flags?

Windows

  1. Exit any running-instance of chrome.
  2. Find the shortcut you normally use to launch chrome.
  3. Create a copy of it
  4. Right click on the new shortcut, and select Properties
  5. At the very end of the Target: text box, add a space and then the desired command line flags.
  6. Double click the new shortcut to launch chrome with the new command line flags.

Mac OS X

  1. Quit any running instance of chrome.
  2. Launch /Applications/Utilities/Terminal.app
  3. At the command prompt enter:
    /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --enable-logging --log-level=0

Linux

  1. Exit any running instance of chrome.
  2. Execute in a console:
    google-chrome --enable-logging --log-level=0

    (If you are using a different named chrome/chromium build, change the command accordingly)

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.

Note that the numbers on the left are timestamps and process IDs.