Currently, I use Path.GetTempPath() to figure out where to write my log files, but recently I came across a user\'s machine where the path returned was not what
Path.GetTempPath()
It calls the GetTempPath function. The documentation explains what environment variables it checks.