diff --git a/shadowsocks-csharp/Controller/Service/AvailabilityStatistics.cs b/shadowsocks-csharp/Controller/Service/AvailabilityStatistics.cs index 5d11e1d8..b9fda44d 100644 --- a/shadowsocks-csharp/Controller/Service/AvailabilityStatistics.cs +++ b/shadowsocks-csharp/Controller/Service/AvailabilityStatistics.cs @@ -216,7 +216,7 @@ namespace Shadowsocks.Controller } catch (Exception e) { - logger.Debug("config changed asynchrously, just ignore this server"); + logger.Debug(e,"config changed asynchrously, just ignore this server"); } } diff --git a/shadowsocks-csharp/Model/NlogConfig.cs b/shadowsocks-csharp/Model/NlogConfig.cs index 11d6d858..cbee2496 100644 --- a/shadowsocks-csharp/Model/NlogConfig.cs +++ b/shadowsocks-csharp/Model/NlogConfig.cs @@ -20,8 +20,18 @@ namespace Shadowsocks.Model Debug, Trace, } - - const string NLOG_CONFIG_FILE_NAME = "NLog.config"; + private static string _NLOG_CONFIG_FILE_NAME=string.Empty; + public static string NLOG_CONFIG_FILE_NAME + { + get + { + if (_NLOG_CONFIG_FILE_NAME.IsNullOrEmpty()) + { + _NLOG_CONFIG_FILE_NAME = Path.Combine(Environment.CurrentDirectory, "NLog.config"); + } + return _NLOG_CONFIG_FILE_NAME; + } + } const string TARGET_MIN_LEVEL_ATTRIBUTE = "minlevel"; const string LOGGER_FILE_NAME_ATTRIBUTE = "fileName"; @@ -108,6 +118,7 @@ namespace Shadowsocks.Model /// public static void TouchAndApplyNLogConfig() { + if (!File.Exists(NLOG_CONFIG_FILE_NAME)) { File.WriteAllText(NLOG_CONFIG_FILE_NAME, Properties.Resources.NLog_config); diff --git a/shadowsocks-csharp/Properties/PublishProfiles/FolderProfile.pubxml b/shadowsocks-csharp/Properties/PublishProfiles/FolderProfile.pubxml index 04cbd20b..411239eb 100644 --- a/shadowsocks-csharp/Properties/PublishProfiles/FolderProfile.pubxml +++ b/shadowsocks-csharp/Properties/PublishProfiles/FolderProfile.pubxml @@ -10,9 +10,8 @@ https://go.microsoft.com/fwlink/?LinkID=208121. netcoreapp3.1 bin\Release\netcoreapp3.1\publish\ win-x86 - true - False - True - True + false + True + False \ No newline at end of file