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();
}
}
查看全文
相关阅读:
发布国内首个无服务器容器服务,运维效率从未如此高效
阿里云异构计算团队亮相英伟达2018 GTC大会
阿里如何将“高峰前扩容、高峰后缩容”的梦想照进现实?
迁移到 GRUB 2
(11计科1班-孙鹏启)SHELL脚本—期末成绩统计
硬盘分区的c盘在外圈还是内圈
Linux内核设计的艺术(第2版)
卸载,弹出,安全移除驱动器 的区别
(11级计科2班-张文旭)关于LINUX连接网络问题
安装Zend Guard Loader
原文地址:https://www.cnblogs.com/adam/p/668253.html
最新文章
100+ 值得收藏的 Web 开发资源
MySql(windows)安装步骤整理
蓝桥杯-奇怪的比赛
金牛第二炮
WiredTiger运行时参数优化
C++程序设计--运算符重载
Geohash介绍
TCP与三次握手
PHP manual-mysqli-connections-翻译
记录R的一些黑魔法
热门文章
HTML 和 CSS 基础
IPFS初窥
赵赵
驱动阿里云的高性能网络引擎- 飞天洛神
如何在一分钟内实现微服务系统下的架构可视化
如何在优雅地Spring 中实现消息的发送和消费
Nacos发布0.5.0版本,轻松玩转动态 DNS 服务
服务化改造的云上利器 | 阿里云 EDAS 重大升级发布
流量隔离方案 Dpath 护航双十一新零售
比MySQL快6倍 深度解析国内首个云原生数据库POLARDB的“王者荣耀”
Copyright © 2011-2022 走看看