-
Notifications
You must be signed in to change notification settings - Fork 150
SNOW-834781: Remove log4net and delegate logging to consumers #1057
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
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
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
…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
…nector-net into SNOW-834781-Remove-log4net
Snowflake.Data/Snowflake.Data.csproj
Outdated
@@ -24,9 +24,10 @@ | |||
<PackageReference Include="Google.Cloud.Storage.V1" Version="4.10.0" /> | |||
<PackageReference Include="Azure.Storage.Blobs" Version="12.13.0" /> | |||
<PackageReference Include="Azure.Storage.Common" Version="12.12.0" /> | |||
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.1" /> |
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.
use 9.0.5
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.
Changed to 9.0.5
Snowflake.Data/Snowflake.Data.csproj
Outdated
@@ -24,9 +24,10 @@ | |||
<PackageReference Include="Google.Cloud.Storage.V1" Version="4.10.0" /> | |||
<PackageReference Include="Azure.Storage.Blobs" Version="12.13.0" /> | |||
<PackageReference Include="Azure.Storage.Common" Version="12.12.0" /> | |||
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.1" /> | |||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.1" /> |
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.
I think this is not needed?
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.
Removed
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1" /> | ||
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.14" /> |
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.
use 5.5.0
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.
Changed to 5.5.0
<PackageReference Include="NUnit" Version="3.14.0" /> | ||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" /> | ||
<PackageReference Include="RichardSzalay.MockHttp" Version="6.0.0" /> | ||
<PackageReference Include="Serilog" Version="4.0.1" /> |
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.
use 4.3.0
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.
Changed to 4.3.0
<PackageReference Include="NUnit" Version="3.14.0" /> | ||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" /> | ||
<PackageReference Include="RichardSzalay.MockHttp" Version="6.0.0" /> | ||
<PackageReference Include="Serilog" Version="4.0.1" /> | ||
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" /> |
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.
use 9.0.2
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.
Changed to 9.0.2
<PackageReference Include="Serilog" Version="4.0.1" /> | ||
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" /> | ||
<PackageReference Include="Serilog.Settings.Xml" Version="1.1.0" /> | ||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" /> |
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.
use 7.0.0
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.
Changed to 7.0.0
…nector-net into SNOW-834781-Remove-log4net
…nector-net into SNOW-834781-Remove-log4net
else | ||
{ | ||
var fileInfo = new UnixFileInfo(path: LogFilePath); | ||
using (var handle = fileInfo.Open(FileMode.Append, FileAccess.ReadWrite, FilePermissions.S_IWUSR | FilePermissions.S_IRUSR)) |
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.
Actually this appender is used only by easy logging. And I think some users would find 600 permissions too restrictive. So I would like to make it configurable in EasyLogging config.
Currently we have the configuration file like that:
{
"common": {
"log_level": "DEBUG",
"log_path": "/path/to/log/directory"
}
}
we could add a "dotnet" section and "log_file_unix_permissions" field in it:
{
"common": {
"log_level": "DEBUG",
"log_path": "/path/to/log/directory"
},
"dotnet": {
"log_file_unix_permissions": "640"
}
}
and then we could create the file with such permissions and verify if the permissions are not broader that specified in the config file.
If such permissions would not be configured in the config file then we could assume 600 as the default value.
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.
I updated the PR to include the changes mentioned above:
- Add
dotnet
section andlog_file_unix_permissions
to config file - Create file with
log_file_unix_permissions
permissions and use those permissions for validating when reading/writing the log file - Use 600 as the default value for
log_file_unix_permissions
if not configured. Also uses 600 if the value in the config is invalid
Please let me know if there's any edits you'd like to make
…nector-net into SNOW-834781-Remove-log4net
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 the chmod of the file is changed?
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.
I've reverted the mode change. It shouldn't have been added in the changes
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 the chmods of the files change?
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 the chmod of the file is changed?
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.
I've reverted the mode change for this one as well
Description
Remove the log4net dependency and replace with the Microsoft logging interface so users can plug in their own custom loggers
Checklist
dotnet test
)