fix log file not created (#7935)

This commit is contained in:
Davide Giacometti 2020-11-09 19:39:02 +01:00 committed by GitHub
parent 8c7f2b6a74
commit 701c119986
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -42,9 +42,9 @@ namespace PowerLauncher
{
string path = Log.CurrentLogDirectory;
var directory = new DirectoryInfo(path);
var log = directory.GetFiles().OrderByDescending(f => f.LastWriteTime).First();
var log = directory.GetFiles().OrderByDescending(f => f.LastWriteTime).FirstOrDefault();
LogFilePathBox.Text = log.FullName;
LogFilePathBox.Text = log?.FullName;
StringBuilder content = new StringBuilder();
content.AppendLine(ErrorReporting.RuntimeInfo());

View File

@ -41,8 +41,8 @@ namespace Wox.Plugin.Logger
var rule = new LoggingRule("*", LogLevel.Info, target);
#endif
configuration.LoggingRules.Add(rule);
LogManager.Configuration = configuration;
target.Dispose();
LogManager.Configuration = configuration;
}
private static void LogInternalException(string message, System.Exception e, Type fullClassName, [CallerMemberName] string methodName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0)