Skip to content

Commit

Permalink
Merge pull request #404 from nventive/dev/topi/fix-logging-issues
Browse files Browse the repository at this point in the history
fix: Cannot activate file logging
  • Loading branch information
Lee31416 authored May 13, 2024
2 parents 3418ae5 + c6c9064 commit 549b28a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Prefix your items with `(Template)` if the change is about the template and not
## 3.4.X
- Added a kill switch feature to the app.
- Bump Uno.WinUI, Uno.WinUI.DevServer, Uno.WinUI.Lottie and Uno.UI.Adapter.Microsoft.Extensions.Logging to 5.0.159 to fix backNavigation/CloseModal crash.
- Fixed an issue with logging configuration not creating the directory before writing the log file in the case logging was disabled by default.

## 3.3.X
- Added a forced update feature to the app.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,17 @@ public static void ConfigureLogging(HostBuilderContext hostBuilderContext, ILogg
AddConsoleLogging(serilogConfiguration);
}

var filepath = logFilesProvider.GetLogFilePath(isAppLogging);

if (options.IsFileLoggingEnabled)
{
AddFileLogging(serilogConfiguration, logFilesProvider.GetLogFilePath(isAppLogging));
AddFileLogging(serilogConfiguration, filepath);
}
else
{
// Ensures the directory is created so we can still write on files down the line.
var directoryPath = Path.GetDirectoryName(filepath);
Directory.CreateDirectory(directoryPath);
}

var logger = serilogConfiguration.CreateLogger();
Expand Down

0 comments on commit 549b28a

Please sign in to comment.