I've set up Jaeger with Opentracing in a Java environment and it works nicely with logging messages with spans and tracing. But I am a bit stuck when it comes to catching and logging exceptions.
try
{
span.log(ImmutableMap.of("Exeption", "ex"));
throw new IllegalArgumentException("Expecting one argument");
}
catch(Exception ex)
{
span.log(ImmutableMap.of("Error", ex));
span.log(ImmutableMap.of("Event", "error", "Error-object", ex, "message", ex.getStackTrace()));
}
But this way does not format error logging in a good readable way.
I have looked around for information about this as it feels pretty obvious there should be as this is one of its components for logging. But I have somehow never seen anything about this. It is mostly about building and structuring spans. Hope anyone can help me with this when it comes to capturing and logging exceptions.