smallrye-context-propagation icon indicating copy to clipboard operation
smallrye-context-propagation copied to clipboard

Add JBoss Logging and log exceptions when calling the thread context

Open kabir opened this issue 5 years ago • 9 comments

providers

kabir avatar Aug 21 '20 12:08 kabir

LGTM, except the wrapping of Throwable, as explained.

FroMage avatar Aug 21 '20 12:08 FroMage

Updated. The rethrow is a nice trick!

kabir avatar Aug 21 '20 12:08 kabir

2020-08-21T12:35:54.6844857Z [ERROR] Failed to execute goal net.revelc.code.formatter:formatter-maven-plugin:2.12.1:validate (default-cli) on project smallrye-context-propagation: File '/home/runner/work/smallrye-context-propagation/smallrye-context-propagation/core/src/main/java/io/smallrye/context/impl/ActiveContextState.java' has not been previously formatted.  Please format file and commit before running validation! -> [Help 1]

FroMage avatar Aug 21 '20 12:08 FroMage

@kabir also, the formatter plugin dislikes you ;-)

[ERROR] Failed to execute goal net.revelc.code.formatter:formatter-maven-plugin:2.12.1:validate (default-cli) on project smallrye-context-propagation: File '/home/runner/work/smallrye-context-propagation/smallrye-context-propagation/core/src/main/java/io/smallrye/context/impl/ActiveContextState.java' has not been previously formatted.  Please format file and commit before running validation! -> [Help 1]

manovotn avatar Aug 21 '20 12:08 manovotn

Formatted and util made

kabir avatar Aug 21 '20 12:08 kabir

TBH I do wonder why we have to log an exception we rethrow, shouldn't it be logged by the caller?

FroMage avatar Aug 21 '20 12:08 FroMage

@FroMage AFAICT it gets swallowed by the CP plumbing

kabir avatar Aug 21 '20 13:08 kabir

@FroMage AFAICT it gets swallowed by the CP plumbing

If we have exception-swallowing in SR-CP I want to know where and fix it. Do you have stack traces?

FroMage avatar Aug 21 '20 13:08 FroMage

TBH I do wonder why we have to log an exception we rethrow, shouldn't it be logged by the caller?

We don't really know who the caller is. In my case it was Reactive Messaging which makes a load of these calls, and it was not logged there which made tracking down why streams suddenly stop emitting data tricky. Although it sounds like we've decided that RM using CP is a bug, there could be other complex things calling this. To me it makes sense having it centralised in CP.

kabir avatar Aug 24 '20 10:08 kabir