我曾在商店工作,将异常处理引入事件日志和数据库表中。
每个都有它们的优点,基于我的经验我可以强调一些。
事件日志 (Shìjiàn rìzhì)
- Industry standard location for exceptions (+)
- Ease of logging (+)
- Can log database connection problems here (+)
- Can build report and viewing apps on top of the event log (+)
- Needs to be flushed every so often, if alot is reported there (-)
- Not as extensible as SQL logging [add custom fields like method name in SQL] (-)
SQL/数据库
- Can handle large volumes of data (+)
- Can handle rapid volume inserts of exceptions (+)
- Single storage location for exception in load balanced environment (+)
- Very customizable (+)
- A little easier to build reporting/notification off of SQL storage (+)
- Different from where typical exceptions are stored (-)
我是否忽略了任何重要的考虑?
我相信其中一些观点值得讨论,但我很好奇其他团队最有效的方法是什么,为什么你对这个选择感到强烈。