Skip to content

Commit e59be7b

Browse files
committed
COH-31130 CPP: Don't print the whole exception stack trace in case of Coherence connection failure
[git-p4: depot-paths = "//dev/main.cpp/": change = 112430]
1 parent 1fdd55f commit e59be7b

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/coherence/component/util/SafeService.cpp

+14-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include "coherence/net/CacheFactory.hpp"
1010
#include "coherence/util/Service.hpp"
1111

12+
#include "coherence/net/messaging/ConnectionException.hpp"
13+
1214
#include "private/coherence/component/net/extend/RemoteCacheService.hpp"
1315
#include "private/coherence/component/net/extend/RemoteService.hpp"
1416
#include "private/coherence/component/util/Service.hpp"
@@ -19,6 +21,7 @@ COH_OPEN_NAMESPACE3(coherence,component,util)
1921
using coherence::component::net::extend::RemoteCacheService;
2022
using coherence::component::net::extend::RemoteService;
2123
using coherence::net::CacheFactory;
24+
using coherence::net::messaging::ConnectionException;
2225
using coherence::security::auth::Subject;
2326
using coherence::util::logging::Logger;
2427

@@ -626,8 +629,17 @@ void SafeService::startService(ServiceType::Handle hService) const
626629
}
627630
catch (Exception::View e)
628631
{
629-
COH_LOG("Unable to start service "
630-
<< getServiceName() << ": " << e, Logger::level_error);
632+
String::View vsMessage = COH_TO_STRING("Error while starting service " << getServiceName() << " : ");
633+
if (instanceof<RemoteService::View>(hService) && instanceof<ConnectionException::View>(e))
634+
{
635+
// COH-30321 - skip printing the stack trace as connection failures are common and the stack trace
636+
// doesn't provide anything useful
637+
COH_LOG(vsMessage << ": " << e, Logger::level_error);
638+
}
639+
else
640+
{
641+
COH_LOG(vsMessage << ": " << e->getStackTrace(), Logger::level_error);
642+
}
631643
stopAfterFailedStart(hService);
632644
COH_THROW (e);
633645
}

0 commit comments

Comments
 (0)