If you think you have followed all steps but records do not flow to your log, consider the following steps.
Step 1. Does PostSharp Logging enhance your code?
The first step is to check whether PostSharp Logging works at build time.
- Compile your project.
- Open the project binary using a decompiler such as ILSpy.
- Go to a method that you are sure must be logged.
- Check the decompiled code. Does it include PostSharp-generated logging code, or is it essentially your source code?
If the decompiled code does not include PostSharp-generated logging code, check the following:
- Is the
PostSharp.Patterns.Diagnosticspackage correctly installed in the project? ThePostSharp.Patterns.Diagnostics.Redistpackage is not enough. - Are you sure that the
SkipPostSharpMSBuild property is not set for this project? - Are you sure that your multicast attributes are correct? To be sure, explicitly use the
[Log]attribute on a select method and test again.
Step 2. Check the run-time setup
If the previous step was successful, that is, if you can see PostSharp-generated logging code, but you still cannot see any record in the log, the problem may be in the run-time configuration.
- Verify that you have followed the instructions to set up the specific logging backend. See Connecting to Source and Target Logging Frameworks for details.
- Verify that the verbosity level in your logging backend is set to a low enough value. Try to enable the most detailed verbosity level and only reduce it after you see that logging is working.
- Verify that the verbosity level in PostSharp Logging is set to a high enough value. For details, see Adjusting Logging Verbosity.