且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在哪里保存应用程序日志?

更新时间:2022-12-21 16:59:17

有关用户特定日志:


  • LocalApplicationData - %APPDATA%/本地/...



有关绑定到用户的用户特定日志简介:




  • 的ApplicationData - %APPDATA%/漫游/...



对于所有其他日志:




  • CommonApplicationData - %ALLUSERSPROFILE%/ ...



请参阅 Environment.SpecialFolder 其他文件夹。


Possible Duplicate:
Where to store an application log file on Windows

Windows seems to have several places where different applications store its logs. Windows services and some applications use the Windows event log, others use C:\ProgramData, another one store them to C:\Users(Local/System/Public/Default)\AppData/(Roaming/Local).

I noticed this when developing Windows services that the default (AppData/Roaming) environment variable points to something like C:\Windows\System32\Users\system\AppData\Roaming or other completely ridiculous locations, so I'm wondering if there's any sheet out there where to store logs for: User Applications/User Services/System Services and more general: What are all these application folders for (What belongs where?)

Thanks!

For user specific logs:

  • LocalApplicationData - %APPDATA%/Local/...

For user specific logs tied to the users profile:

  • ApplicationData - %APPDATA%/Roaming/...

For all other logs:

  • CommonApplicationData - %ALLUSERSPROFILE%/...

See Environment.SpecialFolder for other folders.