Skip to content

Commit d6c542e

Browse files
committed
COH-31131 .NET: Don't print the whole exception stack trace in case of Coherence connection failure
[git-p4: depot-paths = "//dev/main.net/": change = 112431]
1 parent 686ae3d commit d6c542e

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/Coherence/Net/Impl/SafeService.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using System.Threading;
1111

1212
using Tangosol.IO;
13+
using Tangosol.Net.Messaging;
1314
using Tangosol.Run.Xml;
1415
using Tangosol.Util;
1516
using Tangosol.Util.Daemon.QueueProcessor.Service;
@@ -993,9 +994,18 @@ protected virtual void StartService(Util.IService service)
993994
}
994995
catch (Exception e)
995996
{
996-
CacheFactory.Log("Error while starting service \""
997-
+ ServiceName + "\": " + e,
998-
CacheFactory.LogLevel.Error);
997+
string message = "Error while starting service \"" + ServiceName + "\": ";
998+
if (service is RemoteService && e is ConnectionException)
999+
{
1000+
// COH-30321 - skip printing the stack trace as connection failures are common and the stack trace
1001+
// doesn't provide anything useful
1002+
CacheFactory.Log(message + e, CacheFactory.LogLevel.Error);
1003+
}
1004+
else
1005+
{
1006+
CacheFactory.Log(message + e.StackTrace, CacheFactory.LogLevel.Error);
1007+
}
1008+
9991009
try
10001010
{
10011011
service.Stop();

0 commit comments

Comments
 (0)