tags:

views:

36

answers:

2

I am making a small change to an existing application so that users can email us the log file when things go wrong. Even though it is c# the app is using Microsoft.VisualBasic.Logging.FileLogTraceListener.

This gets setup like this:

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

My question is: Where do the log files go?

Is it the same place as Path.GetTempPath() ?

I have seen a bunch of other posts asking similar questions but I need to be sure that whatever computer / operating system this app runs on it is able to pick up the logs. I take it there is no way to look inside the FileLogTraceListener class to see what it does when working with temp?

+2  A: 

Failing documentation, you could:

  • Use Reflector to look at the source
  • Use Process Monitor from SysInternals to see what IO your process is doing.
  • Write a test app that makes two files, one with Path.GetTempPath() and one with VB Logger.
Nate Bross
or stick a breakpoint on the line and inspect the value
Pondidum
Thanks I'll have a look at reflector - I know they are writing to the same place on my pc but am concerned that it could work differently under vista, windows server, etc.
Adam Butler
@Pondidum it looks like its an Enum, so I don't think it will have a real path at runtime, at least that's expossed publicly from the class.
Nate Bross
A: 

It is the same place as Path.getTempPath(). Reflector showed me this:

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

+1 to Nate Bross - reflector helped to find the answer

Adam Butler