自定义写日志方法
标准产品日志太多,自定义一个写日志到 安装目录\K3Cloud\WebSite\Log ,每天写一个log文件
private void WriteLog(string log, string strType = "") { string rootPath = AppDomain.CurrentDomain.BaseDirectory; //这个rootPath 老版本 最后无 \ 新版本有? 另外因权限问题,最好是手工创建并授权 string logPath; // = rootPath + $@"\Log"; if(rootPath.Substring(rootPath.Length - 1,1).Equals(@"\")) { logPath = rootPath + $@"Log"; } else { logPath = rootPath + $@"\Log"; } if (!Directory.Exists(logPath)) Directory.CreateDirectory(logPath);//创建新路径 string strLogFile = logPath + "\\log" + DateTime.Now.ToString("yyyyMMdd") + ".log"; FileStream fs = new FileStream(strLogFile, FileMode.Append); StreamWriter sw = new StreamWriter(fs); sw.WriteLine(DateTime.Now.ToString() + strType + ":" + log); sw.Close(); fs.Close(); }
自定义写日志方法
标准产品日志太多,自定义一个写日志到 安装目录\K3Cloud\WebSite\Log ,每天写一个log文件 private void WriteLog(string log, string ...
点击下载文档
上一篇:我的回合,抽卡!下一篇:BOS进度条使用学习
本文2024-09-16 17:14:56发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-14489.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章