Where to save application logs? [duplicate]

允我心安 提交于 2019-12-12 14:56:35

问题


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!


回答1:


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.




回答2:


The standard place for the log would be the AppData directory
Using %APPDATA% may be problematic with roaming profiles if the logs are numerous or huge : it slows their login process then u can use directory %TEMP% i.e. windows temperory director



来源:https://stackoverflow.com/questions/13031377/where-to-save-application-logs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!