Symptom:
All logging message send from NLogLogger to NLog has incorrect user stack frame.
Root cause:
This is indeed a bug in NLog, having a logger class hierarchy (e.g. NLogLogger extends AbstractLogger) triggers the bug. See http://nlog.codeplex.com/workitem/6350
Workaround 1:
One workaround was proposed in feature request here: https://sourceforge.net/tracker/?func=detail&aid=3379373&group_id=182424&atid=901159, but IMHO, I would not go down that route to guess the layout and repeating a slightly changed user frame detection logic in NLogLogger. And it will break if the layout changes after the logger was created.
Workaround 2:
Another workaround is to avoid the class hierarchy. i.e., have NLogLogger directly implement ILog, moves all the code in AbstractLogger into NLogLogger. It sounds a bit crazy to repeat such large amount of code which could be a maintenance nightmare. But the reality is it can be done with only a little changes with no source code coping by using 3 techniques (a) Conditional compilation, (b) partial class and (c) Add existing item as link.
Proposed changes:
a. Modify AbstractLogger to use conditional compilation, so when it is added to NLog project, it becomes partial of NLogLogger instead of being parent class. See http://code.google.com/p/kennethxublogsource/source/diff?spec=svn239&r=239&format=side&path=/trunk/CommonLoggingExtension/src/Common.Logging.Factory/AbstractLogger2.cs
b. Modify NLogLogger to be a partial class and not inherit from AbstractLogger. See http://code.google.com/p/kennethxublogsource/source/diff?spec=svn239&r=239&format=side&path=/trunk/CommonLoggingExtension/src/Common.Logging.NLog2/NLog2/NLogLogger.cs
c. Define both NLOG and ADAPTER conditional compilation symbol for NLog project. Add AbstractLogger.cs as link to NLog project. See http://code.google.com/p/kennethxublogsource/source/diff?spec=svn239&r=239&format=side&path=/trunk/CommonLoggingExtension/src/Common.Logging.NLog2/Common.Logging.NLog2-2.csproj