Audit Java: system to detect exceptions thrown / caught (aop?)

后端 未结 6 1424
广开言路
广开言路 2021-02-07 08:56

Due to checked exceptions, we can have some problems in production having all exceptions caught in the right place and logged correctly.

I wonder if there is some openso

6条回答
  •  感情败类
    2021-02-07 09:04

    IntelliJ's Inspector can check code for many problems as you write it:

    http://www.jetbrains.com/idea/documentation/inspections.jsp

    But your problem sounds like it's more about education than technology. You need to educate your team on what proper exception handling means, when it should be done, etc. Tools will help, but not putting them into the code is the first place is better.

    We use Spring aspects for our production systems to do logging, tracing, performance calculations, etc. Before, after, and exception advice work wonders - they keep the code in one place and give declarative flexibility as to where they are applied.

    Just one caution: aspects aren't free. They add cost to each method you apply them to, so don't just pile them on. Moderation in all things is the key.

提交回复
热议问题