FlatFile Trace Listener

Topics: Logging Application Block
Aug 24, 2009 at 9:56 AM

I have noticed that by default the FlatFile Trace Listener creates the log file in the executables directory.

Is there any way to customise this?

Cheers,

Aug 24, 2009 at 10:24 AM

Yes. Set the FileName property of the FlatFile trace listener to the path desired. By default, The FileName property is set to trace.log, which logs to its relative path(which is the executable dir).

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Aug 24, 2009 at 10:40 AM

I had noticed a few people had done this. What I was really wanting to do was log to the users 'AppData' folder using something like the 'SpecialFolder' enumeration in .NET?

Is something like this possible?

Cheers,

Aug 24, 2009 at 11:13 AM

Hi,

You can try using environment variables. I tried setting the FileName property to "%APPDATA%\trace.log", and it logging to the app data folder of the user.

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com