代码之家  ›  专栏  ›  技术社区  ›  Adam Butler

火车在哪里Microsoft.VisualBasic.Logging文件临时路径正确

  •  1
  • Adam Butler  · 技术社区  · 14 年前

    我正在对现有的应用程序进行一个小的更改,以便用户在出现问题时可以通过电子邮件向我们发送日志文件。即使是c#应用程序正在使用Microsoft.VisualBasic.Logging文件.FileLogTraceListener。

    FileLogTraceListener fileLogTraceListener = listener as FileLogTraceListener;
    fileLogTraceListener.Location = LogFileLocation.TempDirectory;
    

    我的问题是:日志文件到哪里去了?

    Path.GetTempPath() ?

    2 回复  |  直到 14 年前
        1
  •  2
  •   Nate CSS Guy    14 年前

    如果没有文档,您可以:

    • 使用 Reflector 看看源头
    • 使用 Process Monitor 从SysInternals查看进程正在做什么。
    • 编写一个测试应用程序,生成两个文件,其中一个带有 Path.GetTempPath() 一个是VB记录器。
        2
  •  0
  •   Adam Butler    14 年前

    它和我在同一个地方路径.getTempPath(). 我看了这个:

    private string get_LogFileName()
    {
        string tempPath;
        switch (this.Location)
        {
            case LogFileLocation.TempDirectory:
                tempPath = Path.GetTempPath();
                break;