From 2da030d6a11eb9a48674d1c82c6e29b378a97f84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E5=A3=B0=E8=B5=8B?= Date: Fri, 5 Jan 2024 16:27:14 +0000 Subject: [PATCH] =?UTF-8?q?=E7=AE=80=E5=8C=96Path=20join=20=E6=93=8D?= =?UTF-8?q?=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 秋声赋 --- .../SimpleAdmin.Core/Components/LoggingFileComponent.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/api/SimpleAdmin/SimpleAdmin.Core/Components/LoggingFileComponent.cs b/api/SimpleAdmin/SimpleAdmin.Core/Components/LoggingFileComponent.cs index 5b52782..7128a44 100644 --- a/api/SimpleAdmin/SimpleAdmin.Core/Components/LoggingFileComponent.cs +++ b/api/SimpleAdmin/SimpleAdmin.Core/Components/LoggingFileComponent.cs @@ -1,4 +1,4 @@ -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; using System.Runtime.InteropServices; namespace SimpleAdmin.Core; @@ -62,10 +62,7 @@ public sealed class LoggingFileComponent : IServiceComponent //定义日志文件名 options.FileNameRule = fileName => { - var pathSeparator = @"\"; - if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - pathSeparator = "/";//为linux或bsd时修改路径 - return rootPath + pathSeparator + string.Format(fileName, DateTime.UtcNow); + return Path.Join(rootPath, string.Format(fileName, DateTime.UtcNow)); }; options.FileSizeLimitBytes = 500000 * 1024;//日志最大500M if (_loggingSetting.MessageFormat) -- Gitee