diff --git a/src/ray/util/logging.h b/src/ray/util/logging.h index f63be72eb..d44f785d8 100644 --- a/src/ray/util/logging.h +++ b/src/ray/util/logging.h @@ -25,13 +25,15 @@ namespace ray { #define RAY_ERROR 2 #define RAY_FATAL 3 -#define RAY_LOG_INTERNAL(level) ::ray::internal::CerrLog(level) +#define RAY_LOG_INTERNAL(level) \ + ::ray::internal::CerrLog(level) << __FILE__ << ":" << __LINE__ << ": " + #define RAY_LOG(level) RAY_LOG_INTERNAL(RAY_##level) #define RAY_IGNORE_EXPR(expr) ((void) (expr)); #define RAY_CHECK(condition) \ (condition) ? 0 : ::ray::internal::FatalLog(RAY_FATAL) \ - << __FILE__ << __LINE__ \ + << __FILE__ << ":" << __LINE__ \ << " Check failed: " #condition " " #ifdef NDEBUG @@ -67,8 +69,14 @@ class CerrLog { if (has_logged_) { std::cerr << std::endl; } + // This code is duplicated in the FatalLog class. if (severity_ == RAY_FATAL) { - std::exit(1); +#if defined(_EXECINFO_H) || !defined(_WIN32) + void *buffer[255]; + const int calls = backtrace(buffer, sizeof(buffer) / sizeof(void *)); + backtrace_symbols_fd(buffer, calls, 1); +#endif + std::abort(); } }