简体   繁体   中英

Logging errors/exceptions with log4net

I'm trying to log all exceptions to a sql server database through log4net, and I've seen some posts here explaining how to properly configure the web.config file, but my question is: do it is enough to get the exception logged (the application will log automatically, but in this case it does not work on my app), or do I have to call the logger from code-behind into try/catch statement?

Any suggestion would be appreciated!

Thanks a lot, Epros

You can user Application_Error in global.asax. This is called when an unhandler error occurs.

可能会有所帮助。

没有什么可以自动捕获的,您需要连接未处理的异常以进行日志记录(以与连接任何其他全局异常管理相同的方式)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM