开发者

Can I log an exception thrown and caught in 3rd-party (external) library?

My application uses some third-party libraries. I need to log some exceptions that occur inside lib (e.g. exceptions about read file), but these exceptions are caught in the same library.

Is there some way I can log these exceptions myself, even if they're no开发者_StackOverflowt logged by the library?


Look at AspectJ. You can write an advice around construction (and maybe even thrwoing) of the FileNotFoundException. Be advised though, that it will log every time the the pointcut is reached. With some expertise you will be able to control it.

EDIT: Dave Newtwon pointed at at this example which shows how easy it is to do this once you get the hang of it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜