New issue
Advanced search Search tips

Issue 869181 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Aug 1
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , iOS , Chrome , Mac , Fuchsia
Pri: 3
Type: Bug



Sign in to add a comment

Add an optional prefix to log lines to help out-of-process mojo service development

Project Member Reported by jamescook@chromium.org, Jul 30

Issue description

When working on out-of-process mojo services it can be hard to figure out which log line comes from which process. Often both the browser process and the remote process are running similar shared components (e.g. code in //ui/views for out-of-process). Trying to back-correlate pids with process types is really awkward and it's easy to mistake which process is doing what.

For example, it doesn't really "pop out" that one of these log lines comes from a non-browser process:

[80335:80335:0730/151208.282787:ERROR:remote_text_input_client.cc(102)] Not implemented reached in virtual bool RemoteTextInputClient::GetTextRange(gfx::Range *) const
[80335:80335:0730/151208.282821:ERROR:remote_text_input_client.cc(157)] Not implemented reached in virtual void RemoteTextInputClient::EnsureCaretNotInRect(const gfx::Rect &)
[80672:80672:0730/151208.285440:ERROR:layer_tree_host_impl.cc(2982)] Forcing zero-copy tile initialization as worker context is missing
[80335:80335:0730/151232.422337:ERROR:textfield.cc(1763)] Not implemented reached in virtual bool views::Textfield::ShouldDoLearning()
[80335:80335:0730/151255.747172:ERROR:device_event_log_impl.cc(159)] [15:12:55.747] Network: network_connection_handler.cc:98 Connect Failure: passphrase-required: /service/wifi2
[80335:80335:0730/151255.747226:ERROR:device_event_log_impl.cc(159)] [15:12:55.747] Network: network_connect.cc:194 Connect Failed: passphrase-required For: wifi2_guid

Add an optional "log tag" that prints as a prefix to log lines. Initially we can just use this for out-of-process mojo services, like the shortcut viewer app. The above would become:

[80335:80335:0730/151208.282821:ERROR:remote_text_input_client.cc(157)] Not implemented reached in virtual void RemoteTextInputClient::EnsureCaretNotInRect(const gfx::Rect &)
[shortcut_viewer:80672:80672:0730/151208.285440:ERROR:layer_tree_host_impl.cc(2982)] Forcing zero-copy tile initialization as worker context is missing
[80335:80335:0730/151232.422337:ERROR:textfield.cc(1763)] Not implemented reached in virtual bool views::Textfield::ShouldDoLearning()

 
Project Member

Comment 1 by bugdroid1@chromium.org, Aug 1

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/a0536c3a23752937c960abed4dd2248f4810814d

commit a0536c3a23752937c960abed4dd2248f4810814d
Author: James Cook <jamescook@chromium.org>
Date: Wed Aug 01 20:13:31 2018

base: Add optional prefix to log lines

When working on out-of-process mojo services it is hard to figure out
which log line comes from which process. Often both the browser process
and the remote process are running shared components (e.g. code in
//ui/views in both out-of-process ash and browser process). Trying to
back-correlate pids with process types is really awkward.

Add a optional prefix to the start of log lines so things look like:
[my_process:80672:80672:0730/151208.285440:ERROR:file.cc(2982)]...

Only add the prefix to new mojo service processes because it's
possible there are consumers of existing browser process logging
and I don't want change the format of existing browser or renderer
logs.

Bug:  869181 
Test: added to base_unittests
Change-Id: Ia26a78d69c19e1f5cbf8ecd269e962ad0589d008
Reviewed-on: https://chromium-review.googlesource.com/1156988
Reviewed-by: kylechar <kylechar@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579918}
[modify] https://crrev.com/a0536c3a23752937c960abed4dd2248f4810814d/base/logging.cc
[modify] https://crrev.com/a0536c3a23752937c960abed4dd2248f4810814d/base/logging.h
[modify] https://crrev.com/a0536c3a23752937c960abed4dd2248f4810814d/base/logging_unittest.cc
[modify] https://crrev.com/a0536c3a23752937c960abed4dd2248f4810814d/chrome/utility/mash_service_factory.cc

Status: Fixed (was: Started)

Sign in to add a comment