프로젝트

일반

사용자정보

개정판 12bdcd4b

ID12bdcd4b83b0c5db23fdb4c3ae8cfb529a7802fc
상위 9e29ba79
하위 66128b37

백흠경이(가) 5년 이상 전에 추가함

issue #000: 처리하지 못한 에러에 대한 로그를 남김

Change-Id: I9fbd80e57c7a2e09d5a15571fce2046d07a417ca

차이점 보기:

FinalService/KCOM_FinalService/KCOM_FinalService/FinalService.cs
18 18
        System.Timers.Timer _Timer = new System.Timers.Timer();
19 19
        RemFinalPDFStation _remotingFinal = null;
20 20
        ServiceEventLog _log = null;
21
        public ServiceEventLog logger
22
        {
23
            get { return this._log; }
24
        }
25

  
21 26
        Thread _FirewallOpenThread = null;
22 27
        #endregion
23 28

  
FinalService/KCOM_FinalService/KCOM_FinalService/Program.cs
8 8
{
9 9
    static class Program
10 10
    {
11
        public static ServiceBase[] ServicesToRun = null;
12

  
11 13
        /// <summary>
12 14
        /// The main entry point for the application.
13 15
        /// </summary>
14 16
        static void Main()
15 17
        {
16
            ServiceBase[] ServicesToRun;
18
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
19

  
17 20
            ServicesToRun = new ServiceBase[]
18 21
            {
19 22
                new FinalService()
20 23
            };
21 24
            ServiceBase.Run(ServicesToRun);
22 25
        }
26

  
27
        /// <summary>
28
        /// log unhandled exception
29
        /// </summary>
30
        /// <author>humkyung</author>
31
        /// <date>2019.06.04</date>
32
        /// <param name="sender"></param>
33
        /// <param name="e"></param>
34
        private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
35
        {
36
            try
37
            {
38
                (Program.ServicesToRun[0] as FinalService).logger.Write(String.Format("Error : {0}", e.ExceptionObject.ToString()) + DateTime.Now);
39
            }
40
            catch (Exception ex)
41
            {
42
                Console.WriteLine(ex.InnerException.ToString());
43
            }
44
            finally
45
            {
46
            }
47
        }
23 48
    }
24 49
}

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)