Skip to content

Commit b2f7c83

Browse files
authored
CCDB log improvement + DPL summary of most severe error (#5380)
* Improve error message in CCDB * Print most severe error (not first error)
1 parent 769933f commit b2f7c83

File tree

5 files changed

+15
-9
lines changed

5 files changed

+15
-9
lines changed

CCDB/src/CcdbApi.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ void* CcdbApi::navigateURLsAndRetrieveContent(CURL* curl_handle, std::string con
798798
}
799799
}
800800
} else if (response_code == 404) {
801-
LOG(ERROR) << "Requested resource does not exist";
801+
LOG(ERROR) << "Requested resource does not exist: " << url;
802802
errorflag = true;
803803
} else {
804804
errorflag = true;

Framework/Core/include/Framework/DeviceInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ struct DeviceInfo {
4545
/// A circular buffer for the severity of each of the entries
4646
/// in the circular buffer associated to the device.
4747
std::vector<LogParsingHelpers::LogLevel> historyLevel;
48-
std::string firstError;
48+
std::string firstSevereError;
4949
std::string lastError;
5050
/// An unterminated string which is not ready to be printed yet
5151
std::string unprinted;

Framework/Core/include/Framework/LogParsingHelpers.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ struct LogParsingHelpers {
2626
Info,
2727
Warning,
2828
Error,
29+
Fatal,
2930
Unknown,
3031
Size
3132
};

Framework/Core/src/LogParsingHelpers.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ char const* const LogParsingHelpers::LOG_LEVELS[(int)LogParsingHelpers::LogLevel
2020
"INFO",
2121
"WARNING",
2222
"ERROR",
23+
"FATAL",
2324
"UNKNOWN"};
2425
using LogLevel = o2::framework::LogParsingHelpers::LogLevel;
2526

@@ -52,6 +53,8 @@ LogLevel LogParsingHelpers::parseTokenLevel(std::string_view const s)
5253
return LogLevel::Warning;
5354
} else if (s.compare(LABELPOS, 8, "[ERROR] ") == 0) {
5455
return LogLevel::Error;
56+
} else if (s.compare(LABELPOS, 8, "[FATAL] ") == 0) {
57+
return LogLevel::Fatal;
5558
}
5659
return LogLevel::Unknown;
5760
}

Framework/Core/src/runDataProcessing.cxx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ int calculateExitCode(DeviceSpecs& deviceSpecs, DeviceInfos& infos)
279279
auto& spec = deviceSpecs[di];
280280
if (exitCode == 0 && info.maxLogLevel >= LogParsingHelpers::LogLevel::Error) {
281281
LOG(ERROR) << "SEVERE: Device " << spec.name << " (" << info.pid << ") had at least one "
282-
<< "message above severity ERROR: " << std::regex_replace(info.firstError, regexp, "");
282+
<< "message above severity ERROR: " << std::regex_replace(info.firstSevereError, regexp, "");
283283
exitCode = 1;
284284
}
285285
}
@@ -870,14 +870,16 @@ LogProcessingState processChildrenOutput(DriverInfo& driverInfo,
870870
}
871871
// We keep track of the maximum log error a
872872
// device has seen.
873+
bool maxLogLevelIncreased = false;
873874
if (logLevel > info.maxLogLevel && logLevel > LogParsingHelpers::LogLevel::Info &&
874875
logLevel != LogParsingHelpers::LogLevel::Unknown) {
875876
info.maxLogLevel = logLevel;
877+
maxLogLevelIncreased = true;
876878
}
877-
if (logLevel == LogParsingHelpers::LogLevel::Error) {
879+
if (logLevel >= LogParsingHelpers::LogLevel::Error) {
878880
info.lastError = token;
879-
if (info.firstError.empty()) {
880-
info.firstError = token;
881+
if (info.firstSevereError.empty() || maxLogLevelIncreased) {
882+
info.firstSevereError = token;
881883
}
882884
}
883885
s.remove_prefix(pos + delimiter.length());
@@ -1102,11 +1104,11 @@ int runStateMachine(DataProcessorSpecs const& workflow,
11021104
auto initDebugGUI = []() -> DebugGUI* {
11031105
uv_lib_t supportLib;
11041106
int result = 0;
1105-
#ifdef __APPLE__
1107+
#ifdef __APPLE__
11061108
result = uv_dlopen("libO2FrameworkGUISupport.dylib", &supportLib);
1107-
#else
1109+
#else
11081110
result = uv_dlopen("libO2FrameworkGUISupport.so", &supportLib);
1109-
#endif
1111+
#endif
11101112
if (result == -1) {
11111113
LOG(ERROR) << uv_dlerror(&supportLib);
11121114
return nullptr;

0 commit comments

Comments
 (0)