Has anyone out there used Postsharp AOP framework in a production environment? Are there any pitfalls? In order to do some logging etc, can Postsharp be used in conjunction with Log4Net?
Any tutorials on using Postsharp with Web Apps and/or Log4Net will be highly appreciated.
Thanks In Advance.
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.
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.
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.
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.
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).
All in all, I would def. recommend you try it out for your log4net requirements.