在 .net 中使用 AOP 进行日志记录 [英] Logging with AOP in .net

查看:36
本文介绍了在 .net 中使用 AOP 进行日志记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我厌倦了在我的 c# 应用程序中每个函数的开头使用 Logger.Log("MyMethod") 并开始研究 AOP 如何帮助我.

I'm tired of using Logger.Log("MyMethod") at the beginning of each function in my c# application and started to look at how AOP can help me.

基本上我想要的是记录进入每个方法(公共和私有).互联网上有很多关于这个的讨论,但我还没有找到任何特定的库,在这些库的帮助下,我可以在我的方法前加上 [Log] 属性,就是这样.

Basically what I want is to log entering to every method (public and private). There are a lot of talks about this around the internet, but I hadn't found any specific library, with help of which I'll be able to just prefix my method with [Log] attribute and that's it.

Log4PostSharp 看起来很完美,但只是适用于目前不可用的 PostSharp 1.5.

There's Log4PostSharp which seems to be perfect, but only works with PostSharp 1.5 which isn't available at the moment.

有没有类似 Log4PostSharp 的东西?

Are there some similar to Log4PostSharp things?

感谢帮助

推荐答案

版本 2 可用.http://code.google.com/p/postsharp-user-plugins/下载/列表

这篇关于在 .net 中使用 AOP 进行日志记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆