tersesystems / terse-logback

Structured Logging, Tracing, and Observability with Logback
https://tersesystems.github.io/terse-logback/
Other
196 stars 14 forks source link

Intercept calls to e.printStackTrace() to log to sfl4j #131

Open wsargent opened 2 years ago

wsargent commented 2 years ago

In the situation where there's an e.printStackTrace() we should be able to use bytebuddy to rewrite this to something more like:

Logger logger = LoggerFactory.getLogger(this.getClass());
logger.error(e.getMessage(), e);

This should be able to apply even when you didn't write the code in question.

https://stackoverflow.com/questions/67404010/how-can-i-make-a-log-for-exceptions-using-jdbc/67404400#67404400