zoukankan      html  css  js  c++  java
  • ASP.NET 日志路径

    默认路径

    protected void Button_StreamWrite_Click(object sender, EventArgs e)
    {
        StreamWriter sw = new StreamWriter(@"xxx.log",true);
        sw.WriteLine("Start");
        sw.WriteLine("进行中ing...");
        sw.WriteLine("End");
        sw.Close();
    }
    

    写入的文件会在C盘下,true = 该文件存在,则追加内容,否则,创建New文件,并写入内容

    指定当前服务所在物理路径

    protected void Button_StreamWrite_Click(object sender, EventArgs e)
    {
        string appPath = HttpContext.Current.Server.MapPath(@"log.txt");
        StreamWriter sw = new StreamWriter(appPath,true);
        sw.WriteLine("Start");
        sw.WriteLine("进行中ing...");
        sw.WriteLine("End");
        sw.Close();
    }
    

    写入的文件在app的物理Path下,true = 该文件存在,则追加内容,否则,创建New文件,并写入内容

  • 相关阅读:
    c++ ::和:
    c++ extern
    c++ cpp和hpp
    c++ include
    caffe调试
    caffe blob理解
    poj3126
    FFmpeg滤镜使用指南
    Android之Activity之间传递对象
    Server Tomcat v8.0 Server at localhost failed to start.
  • 原文地址:https://www.cnblogs.com/taadis/p/12125928.html
Copyright © 2011-2022 走看看