Java SDK: Allow exception logging to be customizable for activity failures

We have some use cases where we leverage ApplicationFailure.nonRetryableError for some failures that we expect to happen from an activity.

In these cases, we don’t want these failures to be logged as error. Since we also use a service like Sentry for exception monitoring in our prod services, these expected activity failures will pollute the log and would prefer to only log unexpected failures.

These exceptions are logged from: io.temporal.internal.sync.POJOWorkflowImplementationFactory

It would be nice if we can customize the logging behavior for these failures. Perhaps a way to exclude certain error types (e.g. type field in ApplicationFailure) from being logged, or a callback that we can register to implement our own logging logic.

Additional context in Slack: Slack

My strawman proposal is to create a logger per error type, allowing filtering specific errors through logger config. Would you file an issue against the JavaSDK to get this added?

1 Like

Filed an issue against the JavaSDK here: https://github.com/temporalio/sdk-java/issues/704

1 Like