Miscellaneous

This commit is contained in:
Alexey Milovidov 2024-08-09 20:07:40 +02:00
parent 1935fc293e
commit 239e9deb29

View File

@ -254,6 +254,8 @@ SignalListener::SignalListener(BaseDaemon * daemon_, LoggerPtr log_)
{ {
#if defined(__ELF__) && !defined(OS_FREEBSD) #if defined(__ELF__) && !defined(OS_FREEBSD)
build_id = SymbolIndex::instance().getBuildIDHex(); build_id = SymbolIndex::instance().getBuildIDHex();
#else
build_id = "<unknown>";
#endif #endif
} }
@ -346,7 +348,7 @@ void SignalListener::onTerminate(std::string_view message, UInt32 thread_num) co
size_t pos = message.find('\n'); size_t pos = message.find('\n');
LOG_FATAL(log, "(version {}{}, build id: {}, git hash: {}) (from thread {}) {}", LOG_FATAL(log, "(version {}{}, build id: {}, git hash: {}) (from thread {}) {}",
VERSION_STRING, VERSION_OFFICIAL, !build_id.empty() ? build_id : "<unknown>", GIT_HASH ? GIT_HASH : "<unknown>", thread_num, message.substr(0, pos)); VERSION_STRING, VERSION_OFFICIAL, build_id, GIT_HASH ? GIT_HASH : "<unknown>", thread_num, message.substr(0, pos));
/// Print trace from std::terminate exception line-by-line to make it easy for grep. /// Print trace from std::terminate exception line-by-line to make it easy for grep.
while (pos != std::string_view::npos) while (pos != std::string_view::npos)
@ -380,7 +382,7 @@ try
LOG_FATAL(log, "########## Short fault info ############"); LOG_FATAL(log, "########## Short fault info ############");
LOG_FATAL(log, "(version {}{}, build id: {}, git hash: {}) (from thread {}) Received signal {}", LOG_FATAL(log, "(version {}{}, build id: {}, git hash: {}) (from thread {}) Received signal {}",
VERSION_STRING, VERSION_OFFICIAL, !build_id.empty() ? build_id : "<unknown>", GIT_HASH ? GIT_HASH : "<unknown>", VERSION_STRING, VERSION_OFFICIAL, build_id, GIT_HASH ? GIT_HASH : "<unknown>",
thread_num, sig); thread_num, sig);
std::string signal_description = "Unknown signal"; std::string signal_description = "Unknown signal";
@ -446,13 +448,13 @@ try
if (query_id.empty()) if (query_id.empty())
{ {
LOG_FATAL(log, "(version {}{}, build id: {}, git hash: {}) (from thread {}) (no query) Received signal {} ({})", LOG_FATAL(log, "(version {}{}, build id: {}, git hash: {}) (from thread {}) (no query) Received signal {} ({})",
VERSION_STRING, VERSION_OFFICIAL, !build_id.empty() ? build_id : "<unknown>", GIT_HASH ? GIT_HASH : "<unknown>", VERSION_STRING, VERSION_OFFICIAL, build_id, GIT_HASH ? GIT_HASH : "<unknown>",
thread_num, signal_description, sig); thread_num, signal_description, sig);
} }
else else
{ {
LOG_FATAL(log, "(version {}{}, build id: {}, git hash: {}) (from thread {}) (query_id: {}) (query: {}) Received signal {} ({})", LOG_FATAL(log, "(version {}{}, build id: {}, git hash: {}) (from thread {}) (query_id: {}) (query: {}) Received signal {} ({})",
VERSION_STRING, VERSION_OFFICIAL, !build_id.empty() ? build_id : "<unknown>", GIT_HASH ? GIT_HASH : "<unknown>", VERSION_STRING, VERSION_OFFICIAL, build_id, GIT_HASH ? GIT_HASH : "<unknown>",
thread_num, query_id, query, signal_description, sig); thread_num, query_id, query, signal_description, sig);
} }