summaryrefslogtreecommitdiff
path: root/src/mongo/logv2
diff options
context:
space:
mode:
authorSergey Galtsev <sergey.galtsev@mongodb.com>2021-02-18 21:10:56 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-02-19 17:45:34 +0000
commit51142d61eeea0a30b2691680663d60c17441afce (patch)
tree524e2d2ffee6a797a82593747fb7e9bb7c610bf0 /src/mongo/logv2
parente9f91c18323784288cd89cbbb70bc0eca8e89aae (diff)
downloadmongo-51142d61eeea0a30b2691680663d60c17441afce.tar.gz
SERVER-53852 MongoDB hangs randomly
Diffstat (limited to 'src/mongo/logv2')
-rw-r--r--src/mongo/logv2/file_rotate_sink.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/mongo/logv2/file_rotate_sink.cpp b/src/mongo/logv2/file_rotate_sink.cpp
index e302cce601f..d678d373ce8 100644
--- a/src/mongo/logv2/file_rotate_sink.cpp
+++ b/src/mongo/logv2/file_rotate_sink.cpp
@@ -29,6 +29,7 @@
#include "mongo/logv2/file_rotate_sink.h"
+#include <boost/exception/diagnostic_information.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/iterator/filter_iterator.hpp>
#include <boost/iterator/transform_iterator.hpp>
@@ -39,9 +40,9 @@
#include "mongo/logv2/json_formatter.h"
#include "mongo/logv2/log_detail.h"
#include "mongo/logv2/shared_access_fstream.h"
+#include "mongo/util/stacktrace.h"
#include "mongo/util/string_map.h"
-
namespace mongo::logv2 {
namespace {
#if _WIN32
@@ -173,13 +174,19 @@ void FileRotateSink::consume(const boost::log::record_view& rec,
LogTruncation::Disabled);
// Commented out log line below to get validation of the log id with the errorcodes
// linter LOGV2(4522200, "Writing to log file failed, aborting application");
- std::cout << StringData(buffer.data(), buffer.size()) << std::endl;
+ std::cerr << StringData(buffer.data(), buffer.size()) << std::endl;
+ } catch (const std::exception& ex) {
+ std::cerr << "Caught std::exception of type " << demangleName(typeid(ex)) << ": "
+ << ex.what() << std::endl;
+ } catch (const boost::exception& ex) {
+ std::cerr << "Caught boost::exception of type " << demangleName(typeid(ex)) << ": "
+ << boost::diagnostic_information(ex) << std::endl;
} catch (...) {
- // If the formatting code throws for any reason, ignore and proceed with aborting the
- // application.
+ std::cerr << "Caught unidentified exception" << std::endl;
}
- std::abort();
+ printStackTrace(std::cerr);
+ std::quick_exit(EXIT_FAILURE);
}
}