示例#1
0
        public void StartLogging()
        {
            // Don't start the listener if already started.
            if (m_Listener == null)
            {
                m_Listener        = new TextWriterTraceListener();
                m_Listener.Writer = System.Console.Out;
                Trace.Listeners.Add(m_Listener);

                DiagnosticsHelper.LogApplicationStartup();
            }
        }
示例#2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            Current.DispatcherUnhandledException       += new DispatcherUnhandledExceptionEventHandler(Current_DispatcherUnhandledException);
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            // load user settings
            UserSettings.Settings.Load();

            DiagnosticsHelper.LogApplicationStartup();

            // grab a copy of the cleanup object and attempt to delete any files
            _cleanup = Cleanup.List;
            _cleanup.DeleteAll();
        }
示例#3
0
        /// <summary>
        /// Starts logging. From this point on, logged events (via DiagnosticsHelper.Log*) will be written to file.
        /// If the user strarts the logging then a new log file is created.
        /// </summary>
        /// <param name="userInvoked">True - user started logging. False - service started logging.</param>
        public void StartLogging(bool userInvoked)
        {
            // Don't start the listener if already started.
            if (m_Listener == null)
            {
                m_CurrentLogFileNumber = findMostRecentLogFileNumber();

                if (userInvoked || (m_CurrentLogFileNumber == 0))
                {
                    m_CurrentLogFileNumber++;
                }

                String logFileName = makeLogFileName(m_LogFileFolder, m_CurrentLogFileNumber);

                m_Listener = new TextWriterTraceListener(logFileName, m_TraceName);
                Trace.Listeners.Add(m_Listener);

                DiagnosticsHelper.LogApplicationStartup();
            }
        }