Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a the 'best practice' for location of windows service logfiles?

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?

like image 622
rupello Avatar asked Jan 29 '09 15:01

rupello


People also ask

Where should log files be stored?

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.

Where are the logs for Windows services?

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.

What is the location of Windows log file and what does log file contain?

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.


3 Answers

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.

like image 102
Joe Avatar answered Nov 05 '22 07:11

Joe


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\

like image 40
Jared Avatar answered Nov 05 '22 05:11

Jared


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).

like image 27
Sander Avatar answered Nov 05 '22 07:11

Sander