惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
量子位
大猫的无限游戏
大猫的无限游戏
Hugging Face - Blog
Hugging Face - Blog
S
SegmentFault 最新的问题
Blog — PlanetScale
Blog — PlanetScale
月光博客
月光博客
Google DeepMind News
Google DeepMind News
小众软件
小众软件
WordPress大学
WordPress大学
宝玉的分享
宝玉的分享
MongoDB | Blog
MongoDB | Blog
B
Blog RSS Feed
博客园 - Franky
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog
博客园 - 聂微东
The GitHub Blog
The GitHub Blog
Recent Announcements
Recent Announcements
Y
Y Combinator Blog
Microsoft Security Blog
Microsoft Security Blog
雷峰网
雷峰网
Jina AI
Jina AI
酷 壳 – CoolShell
酷 壳 – CoolShell

博客园 - gotolovo

导出csv 导出excel 正则学习电话匹配 des 加密 解密 - gotolovo c# 发送邮件 工作流学习过程-事务 工作流学习过程-状态机 蛋疼的viewstate 工作流学习过程-持久化服务 工作流学习过程-使用关联 工作流学习过程-本地服务之事件处理 工作流学习过程-本地服务之调用方法 工作流学习过程-验证活动 工作流学习过程-自定义活动 工作流学习过程-开篇 基本的几个排序算法 关于sql中时间的格式转换 数据行变列 请编程遍历页面上所有TextBox控件并给它赋值为空
logmanager
gotolovo · 2011-01-25 · via 博客园 - gotolovo

日志管理类
class LogManager
{
    string logFilePath=string.Empty;
    string logFilePrefix=string.Empth;

    public string LogFilePath
    {
    get
{
    if(string.IsNullOrEmpth(logFilePath))
{
if(System.Web.HttpContext==null)
{
logFilePath =System.AppDomain.CurrentDomain.BaseDirectory;
}else
 {

logFilePath =System.AppDomain.CurrentDomain.BaseDirectory+string.Format(@"log\{0}",System.DateTime.Now.ToString(""));
}
}
}
    }

WriteLog(string logFile,string className,string message)
{
if(!System.IO.Directory.Exists(LogFilePaht))
{
CreateDirectory();
}

using(StreamWriter sw = File.AppendText(LogFilePath+LogFilePrefix+logFile+ "" + DateTime.Now.ToString()))
{
sw.WriteLine();
}

}
}