diff --git a/JY.DAL/SqlHelper.cs b/JY.DAL/SqlHelper.cs index 5ad9cbc..4f6b883 100644 --- a/JY.DAL/SqlHelper.cs +++ b/JY.DAL/SqlHelper.cs @@ -16,7 +16,7 @@ namespace JY.DAL /// /// 数据库连接字符串 /// - private static readonly string connectionString = ConfigurationManager.ConnectionStrings["SqlConn"].ConnectionString; + private static readonly string connectionString = ConfigurationManager.ConnectionStrings["CurDB"].ConnectionString; /// /// 查询列表 diff --git a/JY.Inspection/JY.Inspection.csproj b/JY.Inspection/JY.Inspection.csproj index 31256c3..ae49b5a 100644 --- a/JY.Inspection/JY.Inspection.csproj +++ b/JY.Inspection/JY.Inspection.csproj @@ -1,4 +1,4 @@ - + @@ -374,6 +374,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest diff --git a/JY.Inspection/Log4net.config b/JY.Inspection/Log4net.config new file mode 100644 index 0000000..f127236 --- /dev/null +++ b/JY.Inspection/Log4net.config @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/JY.Inspection/Program.cs b/JY.Inspection/Program.cs index 10b30fa..3342cc4 100644 --- a/JY.Inspection/Program.cs +++ b/JY.Inspection/Program.cs @@ -10,7 +10,6 @@ namespace JY.Inspection { static class Program { - public delegate void RunWorkHandler(); private static HomeForm mFrmMain; diff --git a/JY.Utility/LogHelper.cs b/JY.Utility/LogHelper.cs index 5b5063e..5613fcb 100644 --- a/JY.Utility/LogHelper.cs +++ b/JY.Utility/LogHelper.cs @@ -29,8 +29,22 @@ namespace JY.Utility /// static LogHelper() { + var log4netConfigPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Log4net.config"); + if (!File.Exists(log4netConfigPath)) + { + log4netConfigPath = Path.Combine(Environment.CurrentDirectory, "Log4net.config"); + } + var repository = LogManager.CreateRepository("NETCoreRepository"); - var c = XmlConfigurator.Configure(repository, new FileInfo("Log4net.config")); + var configFile = new FileInfo(log4netConfigPath); + if (configFile.Exists) + { + XmlConfigurator.Configure(repository, configFile); + } + else + { + Console.WriteLine("Log4net.config 文件未找到,日志将无法正常写入"); + } log = LogManager.GetLogger(repository.Name, "Test"); RunClearJob(); }