Miguel
Miguel

Reputation: 321

My Postsharp tracer attribute logs some classes/methods but not others

Background

I'm using Postsharp version 3.0.42.9 and have created a custom tracer attribute (OnMethodBoundaryAspect). I have applied it at the assembly level of my WebForms project like this:

[assembly: MyLogging.Tracer(AttributePriority = 1)]
[assembly: MyLogging.Tracer(AttributeExclude = true, AttributeTargetMembers = "regex:^get_|^set_", AttributePriority = 2)]

The tracer logs entry with method arguments and exit with return value. I'm using NLog to write the log entries to a database table.

I have the following two classes in separate files in the same folder of the same project in my solution and in the same namespace:

public class ClassA : IClassA
{
    public OperationResult PerformOperation(IEnumerable<SomeDto> parameters)
    {
        var classB = new ClassB();
        return classB.AnotherOperation(parameters);
    }        
}

//In a different file
public class ClassB
{
    public OperationResult AnotherOperation(IEnumerable<SomeDto> parameters)
    {
        //Do some stuff
        return operationResult;
    }
}

ClassA is instantiated and invoked from an aspx page.

Problem

I get the logs as expected for the methods in ClassA such as PerformOperation and the aspx page, but nothing gets logged for any methods in ClassB.

Any help is appreciated.

Upvotes: 1

Views: 74

Answers (1)

Miguel
Miguel

Reputation: 321

I am logging to a database table and one of the columns was not large enough to hold the data. When I turned on internal logging for NLog it put me on track to resolve the issue. This was not caused by Postsharp.

Upvotes: 1

Related Questions