public void CreateLogger()
 {
     try
     {
         throw new Exception("some message");
     }
     catch (Exception exc)
     {
         ILogCreator logger = new ExceptionLogger(exc);
         logger.CreateLogs("Support\\TestData\\TestOutput");
         Assert.IsTrue(File.Exists("Support\\TestData\\TestOutput\\exception.log"));
     }
 }
        public void LogCrash(object sender, UnhandledExceptionEventArgs eventArgs)
        {
            Log.Error("MediaPortal: Unhandled exception occured");
            string directory = "log";

            Exception ex;

            if (eventArgs.ExceptionObject is Exception)
            {
                ex = (Exception)eventArgs.ExceptionObject;
                Log.Error(ex);
            }
            else
            {
                ex = new Exception(string.Format(
                                       @"A crash occured, but no Exception object was found. 
                Type of exception: {0}
                object.ToString {1}",
                                       eventArgs.ExceptionObject.GetType(), eventArgs.ExceptionObject.ToString())
                                   );
                Log.Error(ex);
            }

            ExceptionLogger logger = new ExceptionLogger(ex);

            logger.CreateLogs(directory);
            Log.Info("MediaPortal: stop...");
            // GEMX 08.04.08: The WatchDog is now always started in the background and monitors MP itself

            /*
             * Process mpWatchDog = new Process();
             * mpWatchDog.StartInfo.ErrorDialog = true;
             * mpWatchDog.StartInfo.UseShellExecute = true;
             * mpWatchDog.StartInfo.WorkingDirectory = Application.StartupPath;
             * mpWatchDog.StartInfo.FileName = "WatchDog.exe";
             * mpWatchDog.StartInfo.Arguments = "-crashed";
             * mpWatchDog.Start();
             */
            Application.Exit();
        }