问题描述
有没有人在那里已经用在生产环境中 Postsharp AOP框架?是否有缺陷?为了做一些测井等,可以Postsharp用于结合log4net的?
Does anyone out there has used Postsharp AOP framework in production environment? Are there any pitfalls? In order to do some logging etc, can Postsharp be used in conjunction with log4net ?
使用Postsharp与Web应用程序和/或log4net的将是非常美联社preciated任何教程。
Any tutorials on using Postsharp with Web Apps and/or log4net will be highly appreciated.
在此先感谢。
推荐答案
我和另外一个队友使用PostSharp在几个项目正在生产,并已数月不同的方式。例如,在一种情况下,我用它来在发生异常的登录方法的参数值。 PostSharp老挝(包含在PostSharp)是一个易于使用的注射方法调用的方式(在方法入口,出口和例外,例如),你可以轻松地添加日志调用log4net的注册记录仪。
I and one other teammate use PostSharp in different ways on several projects that are in production and have been for months. For example, in one case, I use it to log method parameter values in case of an Exception. PostSharp Laos (included in PostSharp) is an easy to use way of injecting method calls (on method entry, exit and on exceptions, for example) and you could easily add log calls to log4net registered loggers.
这增加了生成时间,足以稍微改变我的体型习惯,但肯定不会太多,它提供的好处,海事组织。在写code,你不妨从当地的构建,这是很容易做到排除它,这样你就可以继续频繁和快速地建立,那么它包含您的构建服务器等上。
It has increased build times, enough to slightly change my build habits, but certainly not too much for the benefits it provides, IMO. While writing code, you may wish to exclude it from your local build, which is easy enough to do, so you can continue to build frequently and quickly, then include it on your build server etc.
下面是一个良好PostSharp教程 ......虽是老了,这是很好的看到它的贯通。实在是在一个控制台,的WinForms,WPF或Web应用程序是我到目前为止遇到使用它没有什么区别。
Here's a good PostSharp tutorial from Gael (the PostSharp creator)... though it is old, it's nice to see it a run-through. There is really no difference in using it in a console, winforms, WPF or WebApp that I've encountered so far.
我也想说,一旦你已经找到了如何老挝方面添加到项目,重复练习非常容易。还有就是你有多少组件/类应用方面多少时间PostSharp添加到您的构建之间的关系。所以,你甚至可以控制生成时发出了一点。
I would also say that once you've figured out how to add Laos aspects to a project, repeating the exercise is very easy. And there is a relationship between how many assemblies/classes you apply the aspects to and how much time PostSharp adds to your build. So you can even control the build time issues a bit.
对于code,我pssed与PostSharp如何工作得非常IM $ P $ ......它从来没有搞砸了一个构建,取得了装配无效或以其他方式搞砸了code。我甚至用它在ASP.NET应用程序,用code覆盖和性能的仪器(因此它与MS'装配检测工具起到很好)。
As for the code, I am very very impressed with how well PostSharp works... it has never screwed up a build, made an assembly invalid or otherwise messed up code. And I have even used it in ASP.NET apps, with code coverage and performance instrumentation (so it's played nicely with MS' Assembly instrumentation tools).
所有的一切,我会DEF。建议你尝试一下你的log4net的要求。
All in all, I would def. recommend you try it out for your log4net requirements.
这篇关于任何人只要有生产Postsharp经验?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!