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

SNOW-1676298: Expose the possibility to disable logging completely (for .NET Native AOT) #1028

Closed
pjmvp opened this issue Sep 21, 2024 · 2 comments
Assignees
Labels
duplicate feature status-triage_done Initial triage done, will be further handled by the driver team

Comments

@pjmvp
Copy link

pjmvp commented Sep 21, 2024

As of today, the constructor for SnowflakeDbConnection calls a SFLoggerFactory.GetLogger() method which in turn calls a GetLogger() method in a LogManager class from the log4net dependency.

That log4net method calls Assembly.GetCallingAssembly() which is not supported when running in native AOT.

I see that SFLoggerFactory has enableLogger and disableLogger methods. However, SFLoggerFactory is a private class so we cannot invoke them. I see no other way of telling the package to use SFLoggerEmptyImpl.

Ideally, the driver would use the ILogger interface, instead of log4net, and I see others have requested that as well.
But besides that, I think that. at the very least, the package should allow us to not use any logging if we so desire. Even if one tries to do so via configuration, the SnowflakeDbConnection will always call GetLogger(). In my case, this makes it impractical (*) to use .NET Native AOT.

(*) The only way I can achieve that is with a reflection dirty-hack, using reflection methods supported in native AOT, to invoke the private method.

@pjmvp pjmvp added the feature label Sep 21, 2024
@github-actions github-actions bot changed the title Expose the possibility to disable logging completely (for .NET Native AOT) SNOW-1676298: Expose the possibility to disable logging completely (for .NET Native AOT) Sep 21, 2024
@pjmvp
Copy link
Author

pjmvp commented Sep 21, 2024

Ref to. #47

@sfc-gh-dszmolka sfc-gh-dszmolka self-assigned this Sep 23, 2024
@sfc-gh-dszmolka sfc-gh-dszmolka added the status-triage_done Initial triage done, will be further handled by the driver team label Sep 23, 2024
@sfc-gh-dszmolka
Copy link
Contributor

hi and thank you for raising this - indeed many of our users already require that the logging dependency is decoupled and let everyone to implement their own. This work is tracked on #204, and as of such, I believe this (#1028) is a duplicate of the older feature request which is ought to get rid of the current logging dependency. I also believe efforts should be focused on that.

Being said that, since having the capability of a decoupled logging library seems important to you, please reach out to your Snowflake account team to let them know of this requirement. This helps prioritizing amongst the multiple requests - thank you in advance for your assistance on the matter !

Closing this one as a duplicate but if the requirement is misunderstood and delegating logging to the library consumers would not help your use case (then deciding whether and how you want to log at all), do comment please and I can reopen.

@sfc-gh-dszmolka sfc-gh-dszmolka closed this as not planned Won't fix, can't repro, duplicate, stale Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate feature status-triage_done Initial triage done, will be further handled by the driver team
Projects
None yet
Development

No branches or pull requests

2 participants