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

"Incorrect" {callsite} value in log file #13

Closed
dulfe opened this issue Jul 8, 2016 · 7 comments · Fixed by #14
Closed

"Incorrect" {callsite} value in log file #13

dulfe opened this issue Jul 8, 2016 · 7 comments · Fixed by #14

Comments

@dulfe
Copy link

dulfe commented Jul 8, 2016

Today I used this library for the first time and I when I was reviewing the log files it generated, I found all calling methods to be "NLog.Owin.Logging.NLogFactory+Logger.WriteCore" instead of my class methods (using ${callsite}). Digging into the the code for NLog and this library I found out that NLog goes up the stack frame and finds the calling method, but since it does not "know" anything about your library, it assumes it is the correct one. (which is wrong in this case)

The problem gets solved by adding these 2 lines to my project, but I think it should be added to the library instead, so the end-user(developer) does not have to worry about it.

LogManager.AddHiddenAssembly(typeof(NLogFactory).Assembly);
LogManager.AddHiddenAssembly(typeof(LoggerExtensions).Assembly);

Hope it helps someone.

@304NotModified
Copy link
Member

304NotModified commented Jul 8, 2016

Thanks for the report!

Is

LogManager.AddHiddenAssembly(typeof(LoggerExtensions).Assembly);

really needed?

@304NotModified
Copy link
Member

Please let me know, then I will release a new version :)

@dulfe
Copy link
Author

dulfe commented Jul 9, 2016

Yes, if you do not add it, the log files show LoggerExtensions as the calling source.

Thank you!

@304NotModified
Copy link
Member

From which package/library are those loggerextensions? Not this one?

@dulfe
Copy link
Author

dulfe commented Jul 9, 2016

That is part of Katana Owin Logging, that calls your logger, so it shows in the stack frame.

@304NotModified
Copy link
Member

Ow yes indeed. Thanks!

@304NotModified
Copy link
Member

Fixed in 1.0.1!

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

Successfully merging a pull request may close this issue.

2 participants