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();
}
}
查看全文
相关阅读:
Lexical Sign Sequence
(UPCOJ暑期训练)Tally Counters
(2019hdu多校第十场) Welcome Party
(2019hdu多校第十场1003) Valentine's Day
更新,线段树模板(支持相关基本操作)
linux(deepin)下Clion的安装及环境配置
2019牛客第7场——C(Governing sand)
【数论】数论之旅:N!分解素因子及若干问题
[二分]Kayaking Trip
[数论之旅]数学定理
原文地址:https://www.cnblogs.com/adam/p/668253.html
最新文章
使用pager进行分页
jsp解决kindeditor在线编辑器struts图片上传问题
Apache无法启动解决 the requested operation has failed
2018多校1 hdu6298 6300 6308
cf 1183B equalize prices
hdu 1754 I Hate It
hdu1166 敌兵布阵
Codeforces Round #602 (Div. 2, based on Technocup 2020 Elimination Round 3)
Codeforces Round #601 (Div. 2)
Codeforces Round #586 (Div. 1 + Div. 2)
热门文章
Codeforces Round #600 (Div. 2)
Educational Codeforces Round 76 (Rated for Div. 2)
Codeforces Round #599 (Div. 2)
数据结构实验
Codeforces Round #598 (Div. 3)
Codeforces Round #597 (Div. 2)
Educational Codeforces Round 73 (Rated for Div. 2)
切蛋糕
小A盗墓
平衡树,treap
Copyright © 2011-2022 走看看