285 def scanLogFile(self, resetReport=False):
286 nonStandardErrorsList = self.knowledgeFileHandler(
'nonStandardErrors.db')
291 for log
in self._logfile:
292 msg.debug(
'Now scanning logfile {0}'.
format(log))
293 seenNonStandardError =
''
296 myGen = trfUtils.lineByLine(log, substepName=self._substepName)
298 msg.error(
'Failed to open transform logfile {0}: {1:s}'.
format(log, e))
300 self._levelCounter[
'ERROR'] = 1
301 self._errorDetails[
'ERROR'] = {
'message':
str(e),
'firstLine': 0,
'count': 1}
303 for line, lineCounter
in myGen:
304 m = self._metaPat.
search(line)
306 key, value = m.groups()
307 self._metaData[key] = value
309 m = self._regExp.
match(line)
313 if 'Core dump from CoreDumpSvc' in line:
314 msg.warning(
'Detected CoreDumpSvc report - activating core dump svc grabber')
315 self.coreDumpSvcParser(log, myGen, line, lineCounter)
318 if 'G4Exception-START' in line:
319 msg.warning(
'Detected G4 exception report - activating G4 exception grabber')
320 self.g4ExceptionParser(myGen, line, lineCounter, 40)
322 if '*** G4Exception' in line:
323 msg.warning(
'Detected G4 9.4 exception report - activating G4 exception grabber')
324 self.g494ExceptionParser(myGen, line, lineCounter)
327 if 'Shortened traceback (most recent user call last)' in line:
328 msg.warning(
'Detected python exception - activating python exception grabber')
329 self.pythonExceptionParser(log, myGen, line, lineCounter)
332 if 'terminate called after throwing an instance of \'std::bad_alloc\'' in line:
333 msg.warning(
'Detected bad_alloc!')
334 self.badAllocExceptionParser(myGen, line, lineCounter)
338 if 'Error in <TFile::ReadBuffer>' in line:
339 self.rootSysErrorParser(myGen, line, lineCounter)
342 if 'Error in <TFile::WriteBuffer>' in line:
343 self.rootSysErrorParser(myGen, line, lineCounter)
346 if any(line
in l
for l
in nonStandardErrorsList):
347 seenNonStandardError = line
350 msg.debug(
'Non-standard line in %s: %s', log, line)
351 self._levelCounter[
'UNKNOWN'] += 1
356 for matchKey
in (
'service',
'level',
'message'):
357 fields[matchKey] = m.group(matchKey)
358 msg.debug(
'Line parsed as: {0}'.
format(fields))
362 for ignorePat
in self._ignoreList.structuredPatterns:
363 serviceMatch = ignorePat[
'service'].
match(fields[
'service'])
364 levelMatch = (ignorePat[
'level'] ==
"" or ignorePat[
'level'] == fields[
'level'])
365 messageMatch = ignorePat[
'message'].
match(fields[
'message'])
366 if serviceMatch
and levelMatch
and messageMatch:
367 msg.info(
'Error message "{0}" was ignored at line {1} (structured match)'.
format(line, lineCounter))
370 if ignoreFlag
is False:
371 for searchPat
in self._ignoreList.searchPatterns:
372 if searchPat.search(line):
373 msg.info(
'Error message "{0}" was ignored at line {1} (search match)'.
format(line, lineCounter))
378 fields[
'level'] =
'IGNORED'
384 if 'std::bad_alloc' in fields[
'message']:
385 fields[
'level'] =
'CATASTROPHE'
388 if fields[
'level'] ==
'FATAL':
389 if seenNonStandardError:
390 line +=
'; ' + seenNonStandardError
393 self._levelCounter[fields[
'level']] += 1
397 if fields[
'level'] ==
'IGNORED' or stdLogLevels[fields[
'level']] >= self._msgDetails:
398 if self._levelCounter[fields[
'level']] <= self._msgLimit:
399 detailsHandled =
False
400 for seenError
in self._errorDetails[fields[
'level']]:
401 if seenError[
'message'] == line:
402 seenError[
'count'] += 1
403 detailsHandled =
True
405 if detailsHandled
is False:
406 self._errorDetails[fields[
'level']].
append({
'message': line,
'firstLine': lineCounter,
'count': 1})
407 elif self._levelCounter[fields[
'level']] == self._msgLimit + 1:
408 msg.warning(
"Found message number {0} at level {1} - this and further messages will be supressed from the report".
format(self._levelCounter[fields[
'level']], fields[
'level']))
412 if 'Total payload read from COOL' in fields[
'message']:
413 msg.debug(
"Found COOL payload information at line {0}".
format(line))
414 a = re.match(
r'(\D+)(?P<bytes>\d+)(\D+)(?P<time>\d+[.]?\d*)(\D+)', fields[
'message'])
415 self._dbbytes +=
int(a.group(
'bytes'))
416 self._dbtime +=
float(a.group(
'time'))