Пример #1
0
        private static void TraceShutdown(IEnvironment environment, IKernel kernel)
        {
            TraceLevel level = kernel.Get<IDeploymentSettingsManager>().GetTraceLevel();
            if (level > TraceLevel.Off)
            {
                string tracePath = Path.Combine(environment.TracePath, Constants.TraceFile);
                string traceLockPath = Path.Combine(environment.TracePath, Constants.TraceLockFile);
                var traceLock = new LockFile(traceLockPath);
                ITracer tracer = new Tracer(tracePath, level, traceLock);
                var attribs = new Dictionary<string, string>();

                // Add an attribute containing the process, AppDomain and Thread ids to help debugging
                attribs.Add("pid", String.Format("{0},{1},{2}",
                    Process.GetCurrentProcess().Id,
                    AppDomain.CurrentDomain.Id.ToString(),
                    System.Threading.Thread.CurrentThread.ManagedThreadId));

                attribs.Add("uptime", TraceModule.UpTime.ToString());

                attribs.Add("lastrequesttime", TraceModule.LastRequestTime.ToString());

                tracer.Trace("Process Shutdown", attribs);
            }
        }