Bug 1346132 (part 1) - Initialize Mozilla logging earlier in nsAppRunner.cpp. r=erahm.

The following functions all call NS_LogInit() (either directly or via
ScopedLogging) and then call LogModule::Init() very shortly after:
XRE_InitChildProcess(), NS_InitXPCOM2(), NS_InitMinimalXPCOM(),
XRE_XPCShellMain().

XREMain::XRE_main() does not, however. This prevents us from using MOZ_LOG
easily in the profiler, because the profiler starts up earlier than logging in
the browser.

This patch adds an early LogModule::Init() to XRE_main(), just after the
NS_LogInit().

--HG--
extra : rebase_source : c25fc891da78755e2f38f4dc672d503734990c47
This commit is contained in:
Nicholas Nethercote 2017-03-10 18:55:40 +11:00
parent f3c903b82e
commit bcac800a39

View File

@ -4557,6 +4557,8 @@ XREMain::XRE_main(int argc, char* argv[], const BootstrapConfig& aConfig)
{
ScopedLogging log;
mozilla::LogModule::Init();
// NB: this must happen after the creation of |ScopedLogging log| since
// ScopedLogging::ScopedLogging calls NS_LogInit, and
// XRE_CreateStatsObject calls Telemetry::CreateStatisticsRecorder,