Ejemplo n.º 1
0
        static void ExceptionHandler(object sender, UnhandledExceptionEventArgs args)
        {
            int       result = unchecked ((int)LinqToDryadException.E_FAIL);
            Exception e      = args.ExceptionObject as Exception;

            if (e != null)
            {
                result = System.Runtime.InteropServices.Marshal.GetHRForException(e);
                DryadLogger.LogCritical(0, e);
            }
            DebugHelper.StopLogging(result);

            if (Debugger.IsAttached)
            {
                Debugger.Break();
            }
            else
            {
                DrLogging.WriteMiniDump();
            }

            // We need to Exit, since other threads in the GM
            // are likely to still be running.
            Environment.Exit(result);
        }
Ejemplo n.º 2
0
        public static void InitializeLogging(DateTime startTime)
        {
            if (!loggingInitialized)
            {
                lock (syncRoot)
                {
                    if (!loggingInitialized)
                    {
                        // Initialize text-based tracing
                        string traceFile = Path.Combine(Directory.GetCurrentDirectory(), "GraphManagerTrace.txt");
                        DryadLogger.Start(traceFile);

                        // Initialize Graph Manager's internal logging
                        DrLogging.Initialize();
                        DebugHelper.SetLogType();

                        // Report start time to Artemis - must come after
                        // DrLogging is initialized so stdout is redirected
                        DrArtemisLegacyReporter.ReportStart((ulong)startTime.Ticks);

                        loggingInitialized = true;
                    }
                }
            }
        }
Ejemplo n.º 3
0
        static void ExceptionHandler(object sender, UnhandledExceptionEventArgs args)
        {
            int       result      = unchecked ((int)LinqToDryadException.E_FAIL);
            Exception e           = args.ExceptionObject as Exception;
            string    errorString = "Unknown exception";

            if (e != null)
            {
                result      = System.Runtime.InteropServices.Marshal.GetHRForException(e);
                errorString = e.ToString();
                DryadLogger.LogCritical(errorString);
                System.Threading.Thread.Sleep(10 * 1000);
            }
            DebugHelper.StopLogging(result, errorString, DateTime.Now.ToLocalTime(), dfsDirectory);

            if (Debugger.IsAttached)
            {
                Debugger.Break();
            }
            else
            {
                DrLogging.WriteMiniDump();
            }

            // We need to Exit, since other threads in the GM
            // are likely to still be running.
            Environment.Exit(result);
        }
Ejemplo n.º 4
0
        public static void StopLogging(int retCode, string errorString, DateTime startTime, Uri dfsDirectory)
        {
            if (loggingInitialized)
            {
                lock (syncRoot)
                {
                    if (loggingInitialized)
                    {
                        // Report stop time to Artemis
                        foreach (DrIReporter reporter in reporters)
                        {
                            reporter.ReportStop(unchecked ((uint)retCode), errorString, (ulong)startTime.ToFileTime());
                        }

                        if (dfsDirectory != null && errorString != null)
                        {
                            UploadToDfs(dfsDirectory, "error.txt", errorString);
                        }

                        // Shutdown Graph Manager's internal logging
                        DrLogging.ShutDown(unchecked ((uint)retCode));

                        loggingInitialized = false;
                    }
                }
            }
        }
Ejemplo n.º 5
0
        public static void InitializeLogging(DateTime startTime)
        {
            if (!loggingInitialized)
            {
                lock (syncRoot)
                {
                    if (!loggingInitialized)
                    {
                        // Initialize Graph Manager's internal logging
                        string logDir = Environment.GetEnvironmentVariable("LOG_DIRS");
                        if (logDir == null)
                        {
                            DrLogging.Initialize("graphmanager", false);
                        }
                        else
                        {
                            // deal with comma-separated list
                            logDir = logDir.Split(',').First().Trim();
                            DrLogging.Initialize(Path.Combine(logDir, "graphmanager"), false);
                        }
                        DrLogging.SetLoggingLevel(DrLogTypeManaged.Info);

                        // Report start time to Artemis - must come after
                        // DrLogging is initialized so stdout is redirected
                        foreach (DrIReporter reporter in reporters)
                        {
                            reporter.ReportStart((ulong)startTime.ToFileTime());
                        }

                        loggingInitialized = true;
                    }
                }
            }
        }
Ejemplo n.º 6
0
 static public void LogInformation(
     string message,
     [CallerFilePath] string file       = "(nofile)",
     [CallerMemberName] string function = "(nofunction)",
     [CallerLineNumber] int line        = -1)
 {
     DrLogging.LogInformation(message, file, function, line);
 }
Ejemplo n.º 7
0
        public static void StopLogging(int retCode)
        {
            if (loggingInitialized)
            {
                lock (syncRoot)
                {
                    if (loggingInitialized)
                    {
                        // Report stop time to Artemis
                        DrArtemisLegacyReporter.ReportStop(unchecked ((uint)retCode));

                        // Shutdown Graph Manager's internal logging
                        DrLogging.ShutDown(unchecked ((uint)retCode));

                        // Shutdown text-based tracing
                        DryadLogger.Stop();

                        loggingInitialized = false;
                    }
                }
            }
        }
Ejemplo n.º 8
0
 public static void SetLogType()
 {
     DrLogging.SetLoggingLevel((DrLogType)DryadLogger.TraceLevel);
 }