-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@PulsarListener method does not log exceptions when throwing RuntimeException, how to fix it? #1008
Comments
Hi @Programmer-yyds ,
|
Hi @Programmer-yyds , The messges are currently logged at debug level (here). We made this decision initially to reduce noise during retries with the expectation that users could enable the exception logging by setting the log level accordingly. However, enabling debug logging brings with it a bunch of other most likely unwanted logging. Ideally, we should provide a configuration ability that will allow exceptions thrown from listeners to be logged at warn/error. We will work on this for the next release. In the meantime you can see the exception by setting the following logger level: logging:
level:
org.springframework.pulsar.listener.DefaultPulsarMessageListenerContainer: debug Thanks |
This creates a separate logger for DefaultPulsarMessageListenerContainer that it uses to log exceptions thrown from listener callback methods. The exceptions are still logged at debug level in order to not change behavior in a patch release. However, the log category used by the logger can then be set to debug level but not spam the logs with the other debug statements in the listener container. Resolves spring-projects#1008
This creates a separate logger for DefaultPulsarMessageListenerContainer that it uses to log exceptions thrown from listener callback methods. The exceptions are still logged at debug level in order to not change behavior in a patch release. However, the log category used by the logger can then be set to debug level but not spam the logs with the other debug statements in the listener container. Resolves spring-projects#1008
We decided adding a separate log category for these exceptions. They are still logged at You can enable it as follows: logging:
level:
org.springframework.pulsar.listener.DefaultPulsarMessageListenerContainer-ListenerErrors: debug |
This creates a separate logger for DefaultPulsarMessageListenerContainer that it uses to log exceptions thrown from listener callback methods. The exceptions are still logged at debug level in order to not change behavior in a patch release. However, the log category used by the logger can then be set to debug level but not spam the logs with the other debug statements in the listener container. Also, adds exception logging to the batch listener invocation using the same listener error logger as the record listener invocation. Resolves spring-projects#1008
This creates a separate logger for DefaultPulsarMessageListenerContainer that it uses to log exceptions thrown from listener callback methods. The exceptions are still logged at debug level in order to not change behavior in a patch release. However, the log category used by the logger can then be set to debug level but not spam the logs with the other debug statements in the listener container. Also, adds exception logging to the batch listener invocation using the same listener error logger as the record listener invocation. Resolves spring-projects#1008
This creates a separate logger for DefaultPulsarMessageListenerContainer that it uses to log exceptions thrown from listener callback methods. The exceptions are still logged at debug level in order to not change behavior in a patch release. However, the log category used by the logger can then be set to debug level but not spam the logs with the other debug statements in the listener container. Also, adds exception logging to the batch listener invocation using the same listener error logger as the record listener invocation. Resolves spring-projects#1008
Question Description: I am using Apache Pulsar integrated with Spring Boot and have defined a message consumer method as shown below:
When the consumeString3 method throws an exception, I expect the exception stack trace to be logged. However, after running the application, no exception logs appear in the console or log files.
Want to confirm why the exception is not printed in the log. Do you need to configure additional properties of Pulsar or Spring Boot to enable exception logging? Using a try-catch block directly inside the @PulsarListener method to log exceptions is generally considered a poor practice for several
The text was updated successfully, but these errors were encountered: