A lot of windows services write daily log files to their application installation directory under "program files".
Windows system apps (eg IIS) use %SystemRoot%\System32\LogFiles. Is something I should do for my service?
All logging files are stored in the same log path directory, which by default is the parent location directory. This path can be (and should be) set to a separate physical storage device, providing greater protection against a system hard disk crash.
You can check Windows service logs in Event Viewer to troubleshoot issues or monitor activity. To open Event Viewer, click Start, point to Administrative Tools, and then click Event Viewer.
By default, Event Viewer log files use the . evt extension and are located in the %SystemRoot%\System32\winevt\Logs folder. Log file name and location information is stored in the registry.
We make the log directory configurable. Depending on usage you may not want logs on the OS drive, or in a location that requires granting rights to more than you need to.
The Event log isn't always the best solution for more verbose logging. We use the event log for error and warning and major state changes (start/stop/etc.) but we use the logfile for more verbose actions.
I would suggest neither, these two typically break in Vista (and XP but not as often) as they require admin privileges to write to. Rather I would suggest %AllUsersProfile%\application data\yourService\
Use the event log - it can store data in rich formats and supports good querying via WMI (e.g. the administrators can query logs from all 100 servers at once for warnings that contain the filename "Payroll.xml" - no digging through log files to troubleshoot services).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With