diff --git a/AIMS/AIMS.csproj b/AIMS/AIMS.csproj index 3c34c69..e16bb90 100644 --- a/AIMS/AIMS.csproj +++ b/AIMS/AIMS.csproj @@ -151,7 +151,7 @@ 5.7.0 - runtime; build; native; contentfiles; analyzers; buildtransitive + runtime; build; native; contentfiles; analyzers; buildtransitive; compile all diff --git a/AIMS/AIMS.xml b/AIMS/AIMS.xml index b82cd83..7257c23 100644 --- a/AIMS/AIMS.xml +++ b/AIMS/AIMS.xml @@ -1,9 +1,9 @@  - Data Source=100.101.220.106;Initial Catalog=AIMSDB_ETKQQMYYY;User ID=sa;Password=Sm@123456; - Data Source=100.101.220.106;Initial Catalog=AIMSDB_DATA;User ID=sa;Password=Sm@123456; - + + Data Source=bj;Initial Catalog=AIMSDB_FJZPTFYY;User ID=sa;Password=Test2020; + Data Source=bj;Initial Catalog=AIMSDB_DATA;User ID=sa;Password=Test2020; Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.10.7)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orcl2))));Persist Security Info=True;User ID=smview;Password=i39; diff --git a/AIMSExtension/PublicMethod.cs b/AIMSExtension/PublicMethod.cs index f9923fe..77e197c 100644 --- a/AIMSExtension/PublicMethod.cs +++ b/AIMSExtension/PublicMethod.cs @@ -1,4 +1,6 @@ -using HelperDB; +using CCIS.Shared; +using HelperDB; +using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; using System.Data; @@ -11,6 +13,7 @@ using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; using System.Windows.Forms; +using static Mono.Security.X509.X520; namespace AIMSExtension { @@ -524,35 +527,44 @@ namespace AIMSExtension /// /// 异常 /// 日志文件地址 - public static void WriteLog(Exception ex, string LogAddress = "") + [Obsolete] + public static void WriteLog(Exception ex, string LogAddress = "", + [System.Runtime.CompilerServices.CallerMemberName] string memberName = "", + [System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "", + [System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0) { - try - { - if (!Directory.Exists(Environment.CurrentDirectory + "/Log")) - { - Directory.CreateDirectory(Environment.CurrentDirectory + "/Log"); - } - //如果日志文件为空,则默认在Debug目internal录下新建 YYYY-mm-dd_Log.log文件 - if (LogAddress == "") - { - LogAddress = Environment.CurrentDirectory + "\\Log\\" + - DateTime.Now.Year + '-' + - DateTime.Now.Month + '-' + - DateTime.Now.Day + "_Log.log"; - } - //把异常信息输出到文件 - StreamWriter sw = new StreamWriter(LogAddress, true); - sw.WriteLine("当前时间:" + DateTime.Now.ToString()); - sw.WriteLine("异常信息:" + ex.Message); - sw.WriteLine("异常对象:" + ex.Source); - sw.WriteLine("调用堆栈:\n" + ex.StackTrace); - sw.WriteLine("触发方法:" + ex.TargetSite); - sw.WriteLine(); - sw.Close(); - } - catch (Exception) - { - } + + var log = SharedContext.StaticInstance.LoggerFactory.CreateLogger("OldLog"); + log.LogError(ex, "异常信息:{Message},触发异常方法:{memberName},异常行号:{sourceLineNumber},异常文件:{sourceFilePath}", + ex.Message,memberName, sourceLineNumber, sourceFilePath); + return; + //try + //{ + // if (!Directory.Exists(Environment.CurrentDirectory + "/Log")) + // { + // Directory.CreateDirectory(Environment.CurrentDirectory + "/Log"); + // } + // //如果日志文件为空,则默认在Debug目internal录下新建 YYYY-mm-dd_Log.log文件 + // if (LogAddress == "") + // { + // LogAddress = Environment.CurrentDirectory + "\\Log\\" + + // DateTime.Now.Year + '-' + + // DateTime.Now.Month + '-' + + // DateTime.Now.Day + "_Log.log"; + // } + // //把异常信息输出到文件 + // StreamWriter sw = new StreamWriter(LogAddress, true); + // sw.WriteLine("当前时间:" + DateTime.Now.ToString()); + // sw.WriteLine("异常信息:" + ex.Message); + // sw.WriteLine("异常对象:" + ex.Source); + // sw.WriteLine("调用堆栈:\n" + ex.StackTrace); + // sw.WriteLine("触发方法:" + ex.TargetSite); + // sw.WriteLine(); + // sw.Close(); + //} + //catch (Exception) + //{ + //} }