Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] NLog logger do not retain callsite information #7

Open
SylwesterZarebski opened this issue May 26, 2020 · 0 comments
Open

Comments

@SylwesterZarebski
Copy link

When using logging with defined callsite i always get NLogLogger.Info (or Warn, Error) instead of my method.

How to reproduce

NLog.config (target definition only):

    <target xsi:type="File" name="File" layout="[${longdate}] ${level} ${callsite:className=true:includeNamespace=false:includeSourcePath=false:methodName=true:cleanNamesOfAnonymousDelegates=true:cleanNamesOfAsyncContinuations=true}: ${message}${onexception:${newline}${exception:format=ToString}}"
            fileName="${specialfolder:folder=LocalApplicationData}/App/log.txt" />

call:

public class Test
{
    public void Method()
    {
        var log = (ILogExtended)LogManager.GetLog(GetType());
        log.Info("Message");
    }
}

It should write to log:

... Info Test.Method: Message

but there is:

... Info NLogLogger.Info: Message

I found information about how to avoid it and will try to make my own logger to verify:
https://stackoverflow.com/questions/7412156/how-to-retain-callsite-information-when-wrapping-nlog

@SylwesterZarebski SylwesterZarebski changed the title [Feature] NLog logger do not retains callsite information [Feature] NLog logger do not retain callsite information May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant