diff --git a/programs/keeper/Keeper.cpp b/programs/keeper/Keeper.cpp index a1bf324f482..8f65141b533 100644 --- a/programs/keeper/Keeper.cpp +++ b/programs/keeper/Keeper.cpp @@ -262,6 +262,7 @@ void Keeper::defineOptions(Poco::Util::OptionSet & options) } int Keeper::main(const std::vector & /*args*/) +try { Poco::Logger * log = &logger(); @@ -473,6 +474,12 @@ int Keeper::main(const std::vector & /*args*/) return Application::EXIT_OK; } +catch (...) +{ + /// Poco does not provide stacktrace. + tryLogCurrentException("Application"); + throw; +} void Keeper::logRevision() const diff --git a/programs/server/Server.cpp b/programs/server/Server.cpp index a5321997779..27ccfcebd21 100644 --- a/programs/server/Server.cpp +++ b/programs/server/Server.cpp @@ -647,6 +647,7 @@ static void sanityChecks(Server & server) } int Server::main(const std::vector & /*args*/) +try { Poco::Logger * log = &logger(); @@ -1845,6 +1846,12 @@ int Server::main(const std::vector & /*args*/) return Application::EXIT_OK; } +catch (...) +{ + /// Poco does not provide stacktrace. + tryLogCurrentException("Application"); + throw; +} std::unique_ptr Server::buildProtocolStackFromConfig( const Poco::Util::AbstractConfiguration & config,