zoukankan
html css js c++ java
获取站点路径方法
/**/
///
<summary>
///
保存程序失败及错误信息到日志
///
</summary>
///
<param name="opLog">
错误信息
</param>
public
void
SaveErrorLog(
string
message)
{
string
filePath
=
System.Web.HttpContext.Current.Server.MapPath(
"
~//LogFile//Test.txt
"
);
System.IO.StreamWriter srWriteLine
=
System.IO.File.CreateText(filePath);
srWriteLine.WriteLine(message);
srWriteLine.Close();
}
当前站点是:
http://localhost/App/Web
/**/
///
<summary>
///
保存程序失败及错误信息到日志
///
</summary>
///
<param name="opLog">
错误信息
</param>
public
void
SaveErrorLog(
string
message)
{
string
fileName
=
System.DateTime.Today.Year.ToString()
+
"
-
"
+
System.DateTime.Today.Month.ToString()
+
"
-
"
+
System.DateTime.Today.Day.ToString()
+
"
.txt
"
;
string
filePath
=
System.Web.HttpContext.Current.Server.MapPath(
"
~//LogFile//
"
+
fileName);
if
(
!
System.IO.File.Exists(filePath))
{
System.IO.StreamWriter srWriteLine
=
System.IO.File.CreateText(filePath);
srWriteLine.WriteLine(message);
srWriteLine.Close();
}
else
{
FileStream fsMyfile
=
new
FileStream(filePath,FileMode.Append, FileAccess.Write);
StreamWriter swMyfile
=
new
StreamWriter(fsMyfile);
swMyfile.WriteLine(message);
swMyfile.Flush();
swMyfile.Close();
fsMyfile.Close();
}
}
查看全文
相关阅读:
Centos7.x做开机启动脚本
贝叶斯方法之一
R程序包
c#调用R
感悟--不可抗拒的行为
IP等级
词语
关于editplus设置java和c#
csc命令
editplus配置csharp
原文地址:https://www.cnblogs.com/adam/p/668253.html
最新文章
Spark术语
shiro缓存机制
shiro会话管理
shiro中JSP标签
shiro中拦截器机制
web中集成shiro
Shiro中Realm
shiro中编码/加密
shiro中INI配置
shiro授权
热门文章
shiro身份验证
关于RabbitMQ
git备份代码
Proxmox
shell 部分语法
Nginx OCSP
Linux安全加固之中间件Tomcat
MySQL Cluster
Centos7.4 yum 安装MariaDB
MySQL各版本的区别
Copyright © 2011-2022 走看看