Beispiel #1
0
        public void Analyze()
        {
            QueryPerformanceCounter(ref _startTime);

            LogInfoEventArgs logInfo = new LogInfoEventArgs(
                LogParserId.ToString(),
                EnumLogFile.UNKNOWN,
                LogProcessStatus.SUCCESS,
                "Process()",
                "Starting..");

            _synContext.Post(OnAnalyzeLog, logInfo);

            if (_iisInfo == null)
            {
                if (!useExistData)
                {
                    if (!Verify())
                    {
                        return;
                    }
                }
                else
                {
                    _parser = LogParserFactory.CreateParserByType(EnumLogFile.W3CEXT);
                }
            }
            else
            {
                _parser = LogParserFactory.CreateParserByType(EnumLogFile.W3CEXT);
            }
            _parser.ParserID         = LogParserId.ToString();
            _parser.ParseLogHandler += ParseLogHandler;
            _parser.UseParallel      = _useParallel;

            if (useExistData)
            {
                _logFilePath = Path.GetDirectoryName(_fileName);
            }
            else
            {
                string path = string.Format("{0}\\Indihiang\\", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData));
                _logFilePath = String.Format("{0}\\Data\\{1}\\", path, LogParserId.ToString());
            }

            //_finish = false;
            //if (_dataQueue == null)
            //    _dataQueue = new Thread(DumpData);
            if (_thread == null)
            {
                _thread = new Thread(Process); // original
            }
            //_thread = new Thread(ParseLog);

            _thread.IsBackground = true;
            _thread.Start();
        }
Beispiel #2
0
        private bool CheckParser()
        {
            _parser          = LogParserFactory.CreateParser(_fileName);
            _parser.LogFile  = _fileName;
            _parser.ParserID = LogParserId.ToString();
            if (_parser == null)
            {
                LogInfoEventArgs logInfo = new LogInfoEventArgs(
                    LogParserId.ToString(),
                    EnumLogFile.UNKNOWN,
                    LogProcessStatus.FAILED,
                    "LogParser.Verify()",
                    "Application cannot verify log file format or there are more than log file format");
                _synContext.Post(OnAnalyzeLog, logInfo);

                return(false);
            }

            return(true);
        }