-
Notifications
You must be signed in to change notification settings - Fork 140
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-834781: Remove log4net and delegate logging to consumers #1057
base: master
Are you sure you want to change the base?
Conversation
…nector-net into SNOW-834781-Remove-log4net # Conflicts: # Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs # Snowflake.Data.Tests/UnitTests/Configuration/EasyLoggingConfigFinderTest.cs # Snowflake.Data/Core/ArrowResultSet.cs # Snowflake.Data/Core/FileTransfer/StorageClient/SFGCSClient.cs # Snowflake.Data/Core/HttpUtil.cs # Snowflake.Data/Core/SFBlockingChunkDownloaderV3.cs # Snowflake.Data/Core/SFStatement.cs
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1057 +/- ##
==========================================
+ Coverage 86.23% 86.90% +0.66%
==========================================
Files 121 124 +3
Lines 11845 12093 +248
Branches 1212 1242 +30
==========================================
+ Hits 10215 10509 +294
+ Misses 1338 1297 -41
+ Partials 292 287 -5 ☔ View full report in Codecov by Sentry. |
…nector-net into SNOW-834781-Remove-log4net
…nector-net into SNOW-834781-Remove-log4net # Conflicts: # Snowflake.Data/Core/FileTransfer/StorageClient/SFGCSClient.cs
…nector-net into SNOW-834781-Remove-log4net
{ | ||
ILoggerFactory factory = LoggerFactory.Create( | ||
builder => builder | ||
.AddConsole() |
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.
does it mean that we create a custom logger with logging to console always enabled?
Could we defer the decision about appenders to the customer configuration?
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.
This means if a customer enables custom logging without setting their own logger then a console logger will be created
If a customer sets the logger then it will return their custom logger with their chosen appenders (logging to console is not enabled unless they added it themselves)
{ | ||
message = SecretDetector.MaskSecrets(message).maskedText; | ||
s_snowflakeLogger.Debug(message, ex); | ||
s_customLogger.LogDebug(FormatBrackets(message), ex); |
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.
Why FormatBrackets is executed only for Debug?
|
||
private static SFLogger logger = null; | ||
private static bool s_isSFLoggerEnabled = true; |
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.
shouldn't it be disabled by default? I thought Easy Logging feature would enable it?
} | ||
|
||
public static void disableLogger() | ||
public static void EnableCustomLogger() |
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.
Let's say that that at the beginning customer logger was disabled.
Let's say that some class has a static logger eq. private static readonly SFLogger logger = SFLoggerFactory.GetLogger<BasicAuthenticator>();
then the logger would have a value of new SFLoggerPair(..., ILoggerEmptyImpl();)
Let's say then the customer would call EnableCustomLogger()
.
The logger obtained in the first line would not be modified.
Am I right?
I think we need to reconfigure all the logger when EnableCustomLogger()
, switching this field value is not enough.
Description
Remove the log4net dependency and replace with the Microsoft logging interface so users can plug in their own custom loggers
Checklist
dotnet test
)