-
Notifications
You must be signed in to change notification settings - Fork 934
NH-4019 - Pass assembly into log4net functions #632
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
NH-4019 - Pass assembly into log4net functions #632
Conversation
GetLoggerByTypeDelegate = GetGetLoggerMethodCall<System.Type>(); | ||
} | ||
public IInternalLogger LoggerFor(string keyName) | ||
{ | ||
return new Log4NetLogger(GetLoggerByNameDelegate(keyName)); | ||
return new Log4NetLogger(GetLoggerByNameDelegate(typeof(Log4NetLoggerFactory).Assembly, keyName)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need an overload for specifying another Assembly
than NHibernate.dll? They are two calls in NHibernate.Test.dll which were likely resolving to the test assembly instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, because the delegate is running in the context of the Log4NetLoggerFactory
class, so when Assembly.GetCallingAssembly()
was called in log4net
, it only goes one call-level up--back to NHibernate
.
May you amend the commit message for it to be associated with NH-4019 please? |
…ve access to Assembly.GetCallingAssembly() in .netstandard version.
@fredericDelaporte done. |
Thanks. |
"Side effect": we will have to take care that any new logger call pass the assembly in, till we have something in the build starting failing otherwise. Or we will have to "redo" that later. |
NH-4019 - Pass assembly into log4net functions
This will be needed for the .netstandard version because
log4net
does not have access to Assembly.GetCallingAssembly() in .netstandard version.This pull request is minimal changes and no
#if
cases.