Where should my library deployed into Windows\System32 write logs?
I've developed an IFilter - a library that is to be deployed into Windows\System32. One possible strategy for reporting errors occuring inside it is writing them to a log file. Where should I put that log file so that I don't have problems wit开发者_运维百科h permissions and this solution is Vista/Win2k8 acceptable?
Don't deploy stuff into System32, the Operating System owns that area. And for COM objects, you have no reason to do so. Put the log file in "%HomeDrive%%HomePath%\LocalLow".
Use the OS's own built-in logging capabilties - look at ReportEvent() and related functions. If you want, you can configure your event source to have its own .log file in the OS's Event Viewer, but that is optional.
精彩评论