コード例 #1
0
ファイル: PLCProcesser.cs プロジェクト: 13TT/TEST2
 public void Start()
 {
     WLog.Start(WLog);
     IsBeginProcess = true;
     new Thread(this.Run).Start();
 }
コード例 #2
0
        private static void InitLog()
        {
            string logType    = ConfigurationManager.AppSettings["logType"].ToString().Trim();
            string logGrade   = ConfigurationManager.AppSettings["logGrade"].ToString().Trim();
            string logMsgType = ConfigurationManager.AppSettings["LogMsgType"].ToString().Trim();
            string logFunName = ConfigurationManager.AppSettings["LogFunctionName"].ToString().Trim();
            string logMessage = ConfigurationManager.AppSettings["LogMessage"].ToString().Trim();
            string logDesp    = ConfigurationManager.AppSettings["LogDescription"].ToString().Trim();
            string seperator  = ConfigurationManager.AppSettings["Seperator"].ToString().Trim();

            Log_Agent_CON = new WriteErrorLog();
            Log_Agent_CON.SetLogPara(logType, logGrade, logMsgType, logFunName, logMessage, logDesp, seperator);
            Log_Agent_CON.IsBeginProcess = true;
            Log_Agent_CON.SleepTime      = 500;
            Log_Agent_CON.logName        = "PLCDataAgent_CON";
            Log_Agent_CON.Start(Log_Agent_CON);
            Log_Agent_CON.WriteLog(Enum_LogType.LogType_StartStop,
                                   Enum_LogGrade.LogGrade_Nin,
                                   Enum_LogMessageType.LogMsgType_Event,
                                   "StartLog",
                                   "Log Thread Start",
                                   "");
            Log_Agent_SRM = new WriteErrorLog();
            Log_Agent_SRM.SetLogPara(logType, logGrade, logMsgType, logFunName, logMessage, logDesp, seperator);
            Log_Agent_SRM.IsBeginProcess = true;
            Log_Agent_SRM.SleepTime      = 500;
            Log_Agent_SRM.logName        = "PLCDataAgent_SRM";
            Log_Agent_SRM.Start(Log_Agent_SRM);
            Log_Agent_SRM.WriteLog(Enum_LogType.LogType_StartStop,
                                   Enum_LogGrade.LogGrade_Nin,
                                   Enum_LogMessageType.LogMsgType_Event,
                                   "StartLog",
                                   "Log Thread Start",
                                   "");
            Log_Agent_BUS = new WriteErrorLog();
            Log_Agent_BUS.SetLogPara(logType, logGrade, logMsgType, logFunName, logMessage, logDesp, seperator);
            Log_Agent_BUS.IsBeginProcess = true;
            Log_Agent_BUS.SleepTime      = 500;
            Log_Agent_BUS.logName        = "WMBusniess";
            Log_Agent_BUS.Start(Log_Agent_BUS);
            Log_Agent_BUS.WriteLog(Enum_LogType.LogType_StartStop,
                                   Enum_LogGrade.LogGrade_Nin,
                                   Enum_LogMessageType.LogMsgType_Event,
                                   "StartLog",
                                   "Log Thread Start",
                                   "");
            Log_Agent_DB = new WriteErrorLog();
            Log_Agent_DB.SetLogPara(logType, logGrade, logMsgType, logFunName, logMessage, logDesp, seperator);
            Log_Agent_DB.IsBeginProcess = true;
            Log_Agent_DB.SleepTime      = 500;
            Log_Agent_DB.logName        = "SQLDubug";
            Log_Agent_DB.Start(Log_Agent_DB);
            Log_Agent_DB.WriteLog(Enum_LogType.LogType_Debug,
                                  Enum_LogGrade.LogGrade_Nin,
                                  Enum_LogMessageType.LogMsgType_Event,
                                  "StartLog",
                                  "Log Thread Start",
                                  "");
            Log_Agent_TEMP = new WriteErrorLog();
            Log_Agent_TEMP.SetLogPara(logType, logGrade, logMsgType, logFunName, logMessage, logDesp, seperator);
            Log_Agent_TEMP.IsBeginProcess = true;
            Log_Agent_TEMP.SleepTime      = 500;
            Log_Agent_TEMP.logName        = "TagTemp";
            Log_Agent_TEMP.Start(Log_Agent_DB);
            Log_Agent_TEMP.WriteLog(Enum_LogType.LogType_StartStop,
                                    Enum_LogGrade.LogGrade_Nin,
                                    Enum_LogMessageType.LogMsgType_Event,
                                    "StartLog",
                                    "Log Thread Start",
                                    "");
        }