Skip to content

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

Merged
merged 1 commit into from
May 30, 2017

Conversation

ngbrown
Copy link
Contributor

@ngbrown ngbrown commented May 27, 2017

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.

GetLoggerByTypeDelegate = GetGetLoggerMethodCall<System.Type>();
}
public IInternalLogger LoggerFor(string keyName)
{
return new Log4NetLogger(GetLoggerByNameDelegate(keyName));
return new Log4NetLogger(GetLoggerByNameDelegate(typeof(Log4NetLoggerFactory).Assembly, keyName));
Copy link
Member

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.

Copy link
Contributor Author

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.

@ngbrown ngbrown mentioned this pull request May 28, 2017
29 tasks
@fredericDelaporte fredericDelaporte changed the title NH-3807 - Pass assembly into log4net functions NH-4019 - Pass assembly into log4net functions May 29, 2017
@fredericDelaporte
Copy link
Member

May you amend the commit message for it to be associated with NH-4019 please?

…ve access to Assembly.GetCallingAssembly() in .netstandard version.
@ngbrown ngbrown force-pushed the NH-3807-log4net branch from 6ca0d8c to be69f1b Compare May 30, 2017 02:58
@ngbrown
Copy link
Contributor Author

ngbrown commented May 30, 2017

@fredericDelaporte done.

@fredericDelaporte fredericDelaporte merged commit e49268c into nhibernate:master May 30, 2017
@fredericDelaporte
Copy link
Member

Thanks.

@fredericDelaporte fredericDelaporte added this to the 5.0.0 milestone May 30, 2017
@fredericDelaporte
Copy link
Member

"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.

@ngbrown ngbrown deleted the NH-3807-log4net branch June 27, 2017 04:49
@hazzik hazzik added the r: Fixed label Aug 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants