summaryrefslogtreecommitdiffstats
path: root/remoting/host
diff options
context:
space:
mode:
authoralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-18 01:59:29 +0000
committeralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-18 01:59:29 +0000
commitbc825c0b667e0a5ffa7a86b2ad3eaf9e677108e4 (patch)
treeac6428717f771c967be2b82dca409f8232bce8d6 /remoting/host
parentf36f84cc1be4e03a921e365ff7b9c93a8cd6c325 (diff)
downloadchromium_src-bc825c0b667e0a5ffa7a86b2ad3eaf9e677108e4.zip
chromium_src-bc825c0b667e0a5ffa7a86b2ad3eaf9e677108e4.tar.gz
chromium_src-bc825c0b667e0a5ffa7a86b2ad3eaf9e677108e4.tar.bz2
Redirect Chromoting Host debug logs to Windows event tracing (ETW) instead of a file on disk.
This CL prevents infinite growth of debug.log over time. The debug output is redirected to ETW logging. Sawbuck (http://code.google.com/p/sawbuck/) or standard ETW tools can be used to view the debug output. The debug build still uses "debug.log" (along with ETW) to simplify debugging. The installation registers "Chromoting" provider with Sawbuck and deletes the existing "debug.log" file during both installation and uninstallation. BUG=156135 Review URL: https://chromiumcodereview.appspot.com/11188016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162614 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host')
-rw-r--r--remoting/host/desktop_process.cc17
-rw-r--r--remoting/host/installer/win/chromoting.wxs34
-rw-r--r--remoting/host/logging.h17
-rw-r--r--remoting/host/logging_posix.cc21
-rw-r--r--remoting/host/logging_win.cc46
-rw-r--r--remoting/host/remoting_me2me_host.cc16
-rw-r--r--remoting/host/simple_host_process.cc15
-rw-r--r--remoting/host/win/elevated_controller_module.cc13
-rw-r--r--remoting/host/win/host_service.cc11
9 files changed, 128 insertions, 62 deletions
diff --git a/remoting/host/desktop_process.cc b/remoting/host/desktop_process.cc
index 77e5410..4a4ab6d 100644
--- a/remoting/host/desktop_process.cc
+++ b/remoting/host/desktop_process.cc
@@ -10,13 +10,12 @@
#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/file_path.h"
-#include "base/logging.h"
#include "base/scoped_native_library.h"
#include "base/stringprintf.h"
#include "base/utf_string_conversions.h"
#include "base/win/windows_version.h"
-#include "remoting/host/branding.h"
#include "remoting/host/host_exit_codes.h"
+#include "remoting/host/logging.h"
#include "remoting/host/usage_stats_consent.h"
#if defined(OS_MACOSX)
@@ -74,19 +73,7 @@ int main(int argc, char** argv) {
// LazyInstance, MessageLoop).
base::AtExitManager exit_manager;
- // Initialize logging with an appropriate log-file location, and default to
- // log to that on Windows, or to standard error output otherwise.
- FilePath debug_log = remoting::GetConfigDir().
- Append(FILE_PATH_LITERAL("debug.log"));
- InitLogging(debug_log.value().c_str(),
-#if defined(OS_WIN)
- logging::LOG_ONLY_TO_FILE,
-#else
- logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG,
-#endif
- logging::DONT_LOCK_LOG_FILE,
- logging::APPEND_TO_OLD_LOG_FILE,
- logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS);
+ remoting::InitHostLogging();
const CommandLine* command_line = CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(kHelpSwitchName) ||
diff --git a/remoting/host/installer/win/chromoting.wxs b/remoting/host/installer/win/chromoting.wxs
index 09acada..a7754a0 100644
--- a/remoting/host/installer/win/chromoting.wxs
+++ b/remoting/host/installer/win/chromoting.wxs
@@ -353,6 +353,38 @@
</RegistryKey>
</Component>
+
+ <!-- Register with Sawbuck. See http://code.google.com/p/sawbuck/. -->
+ <Component Id="sawbuck_provider" Guid="*">
+ <RegistryKey Root="HKLM"
+ Key="SOFTWARE\Google\Sawbuck\Providers">
+ <RegistryKey Key="{2db51ca1-4fd8-4b88-b5a2-fb8606b66b02}"
+ Action="create">
+ <RegistryValue Type="string" Value="Chromoting"/>
+ <RegistryValue Name="default_flags" Type="integer" Value="1"/>
+ <RegistryValue Name="default_level" Type="integer" Value="4"/>
+ <RegistryKey Key="Flags" Action="create">
+ <RegistryKey Key="Stack Trace" Action="create">
+ <RegistryValue Type="integer" Value="1"/>
+ </RegistryKey>
+ <RegistryKey Key="Text Only" Action="create">
+ <RegistryValue Type="integer" Value="2"/>
+ </RegistryKey>
+ </RegistryKey>
+ </RegistryKey>
+ </RegistryKey>
+ </Component>
+
+ </DirectoryRef>
+
+ <DirectoryRef Id="config_files">
+ <!-- Delete debug.log from previous versions -->
+ <Component Id="delete_debug_log"
+ Guid="b309082a-e6fa-4dc7-98e4-3d83c896561d">
+ <RemoveFile Id="debug.log"
+ Name="debug.log"
+ On="both" />
+ </Component>
</DirectoryRef>
<!-- The service is always installed in the stopped state with start type
@@ -403,6 +435,7 @@
<UIRef Id="WixUI_ErrorProgressText" />
<Feature Id="chromoting_host" Level="1" Title="$(var.ChromotingHost)">
+ <ComponentRef Id="delete_debug_log"/>
<?if $(var.OfficialBuild) != 0 ?>
<ComponentRef Id="omaha_registration"/>
<?endif?>
@@ -413,6 +446,7 @@
<?endif?>
<ComponentRef Id="remoting_host"/>
<ComponentRef Id="sas"/>
+ <ComponentRef Id="sawbuck_provider"/>
</Feature>
<!-- Set the icon shown in Add/Remove Programs. -->
diff --git a/remoting/host/logging.h b/remoting/host/logging.h
new file mode 100644
index 0000000..5b59516
--- /dev/null
+++ b/remoting/host/logging.h
@@ -0,0 +1,17 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef REMOTING_HOST_LOGGING_H_
+#define REMOTING_HOST_LOGGING_H_
+
+#include "base/logging.h"
+
+namespace remoting {
+
+// Initializes host logging.
+extern void InitHostLogging();
+
+} // namespace remoting
+
+#endif // REMOTING_HOST_LOGGING_H_
diff --git a/remoting/host/logging_posix.cc b/remoting/host/logging_posix.cc
new file mode 100644
index 0000000..fa6be18
--- /dev/null
+++ b/remoting/host/logging_posix.cc
@@ -0,0 +1,21 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "remoting/host/logging.h"
+
+#include "base/logging.h"
+
+namespace remoting {
+
+void InitHostLogging() {
+ // Write logs to the system debug log.
+ logging::InitLogging(
+ NULL,
+ logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG,
+ logging::LOCK_LOG_FILE,
+ logging::DELETE_OLD_LOG_FILE,
+ logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS);
+}
+
+} // namespace remoting
diff --git a/remoting/host/logging_win.cc b/remoting/host/logging_win.cc
new file mode 100644
index 0000000..0ab6f59
--- /dev/null
+++ b/remoting/host/logging_win.cc
@@ -0,0 +1,46 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "remoting/host/logging.h"
+
+#include <guiddef.h>
+
+#include "base/file_path.h"
+#include "base/logging.h"
+#include "base/logging_win.h"
+#include "remoting/host/branding.h"
+
+// {2db51ca1-4fd8-4b88-b5a2-fb8606b66b02}
+const GUID kRemotingHostLogProvider =
+ { 0x2db51ca1, 0x4fd8, 0x4b88,
+ { 0xb5, 0xa2, 0xfb, 0x86, 0x06, 0xb6, 0x6b, 0x02 } };
+
+namespace remoting {
+
+void InitHostLogging() {
+#if defined(NDEBUG)
+ // Write logs to the system debug log in release build.
+ logging::InitLogging(
+ NULL,
+ logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG,
+ logging::LOCK_LOG_FILE,
+ logging::DELETE_OLD_LOG_FILE,
+ logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS);
+#else // !defined(NDEBUG)
+ // Write logs to a file in debug build.
+ FilePath debug_log = remoting::GetConfigDir().
+ Append(FILE_PATH_LITERAL("debug.log"));
+ logging::InitLogging(
+ debug_log.value().c_str(),
+ logging::LOG_ONLY_TO_FILE,
+ logging::LOCK_LOG_FILE,
+ logging::DELETE_OLD_LOG_FILE,
+ logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS);
+#endif // !defined(NDEBUG)
+
+ // Enable trace control and transport through event tracing for Windows.
+ logging::LogEventProvider::Initialize(kRemotingHostLogProvider);
+}
+
+} // namespace remoting
diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc
index b3b9fe0..c502933 100644
--- a/remoting/host/remoting_me2me_host.cc
+++ b/remoting/host/remoting_me2me_host.cc
@@ -12,7 +12,6 @@
#include "base/command_line.h"
#include "base/file_path.h"
#include "base/file_util.h"
-#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
#include "base/scoped_native_library.h"
@@ -51,6 +50,7 @@
#include "remoting/host/host_user_interface.h"
#include "remoting/host/ipc_consts.h"
#include "remoting/host/json_host_config.h"
+#include "remoting/host/logging.h"
#include "remoting/host/log_to_server.h"
#include "remoting/host/network_settings.h"
#include "remoting/host/policy_hack/policy_watcher.h"
@@ -752,19 +752,7 @@ int main(int argc, char** argv) {
return 0;
}
- // Initialize logging with an appropriate log-file location, and default to
- // log to that on Windows, or to standard error output otherwise.
- FilePath debug_log = remoting::GetConfigDir().
- Append(FILE_PATH_LITERAL("debug.log"));
- InitLogging(debug_log.value().c_str(),
-#if defined(OS_WIN)
- logging::LOG_ONLY_TO_FILE,
-#else
- logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG,
-#endif
- logging::DONT_LOCK_LOG_FILE,
- logging::APPEND_TO_OLD_LOG_FILE,
- logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS);
+ remoting::InitHostLogging();
#if defined(TOOLKIT_GTK)
// Required for any calls into GTK functions, such as the Disconnect and
diff --git a/remoting/host/simple_host_process.cc b/remoting/host/simple_host_process.cc
index 1b5b658..dd26e4a 100644
--- a/remoting/host/simple_host_process.cc
+++ b/remoting/host/simple_host_process.cc
@@ -23,7 +23,6 @@
#include "base/command_line.h"
#include "base/environment.h"
#include "base/file_path.h"
-#include "base/logging.h"
#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/string_number_conversions.h"
@@ -49,6 +48,7 @@
#include "remoting/host/host_secret.h"
#include "remoting/host/it2me_host_user_interface.h"
#include "remoting/host/json_host_config.h"
+#include "remoting/host/logging.h"
#include "remoting/host/log_to_server.h"
#include "remoting/host/network_settings.h"
#include "remoting/host/register_support_host_request.h"
@@ -389,18 +389,7 @@ int main(int argc, char** argv) {
base::AtExitManager exit_manager;
- // Initialize logging with an appropriate log-file location, and default to
- // log to that on Windows, or to standard error output otherwise.
- FilePath debug_log(FILE_PATH_LITERAL("debug.log"));
- InitLogging(debug_log.value().c_str(),
-#if defined(OS_WIN)
- logging::LOG_ONLY_TO_FILE,
-#else
- logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG,
-#endif
- logging::DONT_LOCK_LOG_FILE,
- logging::APPEND_TO_OLD_LOG_FILE,
- logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS);
+ remoting::InitHostLogging();
#if defined(TOOLKIT_GTK)
gfx::GtkInitFromCommandLine(*cmd_line);
diff --git a/remoting/host/win/elevated_controller_module.cc b/remoting/host/win/elevated_controller_module.cc
index 8b57a9e..620901c 100644
--- a/remoting/host/win/elevated_controller_module.cc
+++ b/remoting/host/win/elevated_controller_module.cc
@@ -8,10 +8,8 @@
#include "base/at_exit.h"
#include "base/command_line.h"
-#include "base/file_path.h"
-#include "base/logging.h"
#include "remoting/base/breakpad.h"
-#include "remoting/host/branding.h"
+#include "remoting/host/logging.h"
#include "remoting/host/usage_stats_consent.h"
// MIDL-generated declarations.
@@ -49,14 +47,7 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int command) {
// FilePath, LazyInstance, MessageLoop).
base::AtExitManager exit_manager;
- // Write logs to the application profile directory.
- FilePath debug_log = remoting::GetConfigDir().
- Append(FILE_PATH_LITERAL("debug.log"));
- InitLogging(debug_log.value().c_str(),
- logging::LOG_ONLY_TO_FILE,
- logging::DONT_LOCK_LOG_FILE,
- logging::APPEND_TO_OLD_LOG_FILE,
- logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS);
+ remoting::InitHostLogging();
return _AtlModule.WinMain(command);
}
diff --git a/remoting/host/win/host_service.cc b/remoting/host/win/host_service.cc
index 5de9c0f..7158ea0 100644
--- a/remoting/host/win/host_service.cc
+++ b/remoting/host/win/host_service.cc
@@ -17,7 +17,6 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/file_path.h"
-#include "base/logging.h"
#include "base/message_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/stringprintf.h"
@@ -29,6 +28,7 @@
#include "remoting/base/scoped_sc_handle_win.h"
#include "remoting/base/stoppable.h"
#include "remoting/host/branding.h"
+#include "remoting/host/logging.h"
#if defined(REMOTING_MULTI_PROCESS)
#include "remoting/host/daemon_process.h"
@@ -486,14 +486,7 @@ int CALLBACK WinMain(HINSTANCE instance,
// FilePath, LazyInstance, MessageLoop).
base::AtExitManager exit_manager;
- // Write logs to the application profile directory.
- FilePath debug_log = remoting::GetConfigDir().
- Append(FILE_PATH_LITERAL("debug.log"));
- InitLogging(debug_log.value().c_str(),
- logging::LOG_ONLY_TO_FILE,
- logging::DONT_LOCK_LOG_FILE,
- logging::APPEND_TO_OLD_LOG_FILE,
- logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS);
+ remoting::InitHostLogging();
const CommandLine* command_line = CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(kHelpSwitchName) ||