0
votes

I'm trying to implement logging with PostSharp and multicastAttribute. Using the Logging aspect that comes in PostSharp Diagnostics library.

I have a GlboalAspects.cs in the start up project directory. The content is as follows.

`[assembly: PostSharp.Patterns.Diagnostics.LogAttribute(AttributeTargetTypes = "alp_generator.*", AttributeTargetMemberAttributes = PostSharp.Extensibility.MulticastAttributes.NonAbstract )]`

right clickeing my projects and selecting properties, the default namepsace is "alp_generator"

I don't know that "PostSharp.Patterns.Diagnostics.LogAttribute" is correct.

I get no logging at all. If I apply the [Log] Attribute to any method, it logs as expected.

I'd appreciate any ideas in getting this working. Thanks in advance.

BTW, I've gone through PostSharp documentation, and I didn't see anything that helped me get this working.

1
Did you use the wizard to achieve this? (Right click on project > Add > PostSharp policy... > Diagnostics > Add logging and follow the wizard.) - Antonín Procházka
I use the wizard to add the logging aspect to classes. The wizard doesn't or I don't know how to use the wizard to create the globalAspects.cs. - t.durden

1 Answers

1
votes

Using the project wizard instead of the class wizard does that. It sets up everything and it also creates the GlobalAspects.cs file. If the options offered by the wizard are not sufficient, you can manually edit the GlobalAspects.cs file according to http://doc.postsharp.net/multicast-conceptual.

The wizard is available by right-clicking the Project you want to add logging to > Add > PostSharp policy... > Diagnostics > Add logging.