Repository navigation
Logging & Log Rotation
- Introduction
- Logs in Servy Manager
- Event IDs
- Logging Settings
- CLI Options
- CLI Example
- PowerShell Options
- PowerShell Example
- Internal Servy Logs
Servy provides flexible logging to monitor your services in real time, capturing important events in Windows Event Logs, local log files at %ProgramData%\Servy\logs\ as well as standard output and error streams (stdout/stderr). Logs can be viewed in Servy Manager, filtered by level, date, or keyword, and optionally rotated to prevent disk space issues.
- Important events are logged in Windows Event Viewer and can be browsed from Servy Manager.
- Logs Tab: Quickly search logs by log level, date, and keyword for easy monitoring and troubleshooting.
-
Message Format: Each log entry starts with
[ServiceName]followed by the message.- Example:
[MyService] Health monitoring started.
- Example:
Servy assigns specific Event IDs to distinguish between types of service logs. These IDs are recorded in Windows Event Viewer and are useful for filtering, searching, and automation.
| Level | Event ID Range | Purpose |
|---|---|---|
| Info | 1000-1099 | Lifecycle milestones (start, stop, recovery success) |
| Warning | 2000-2099 | Recoverable degradations (retries, fallback paths) |
| Error | 3000-3099 | Core errors (DPAPI failures, DB init failures, ...) |
| Error | 3100-3199 | Script / scheduled-task errors (ServyFailureEmail.ps1 etc.) |
- 2002 = transient migration warning (pre-escalation; auto-clears on next successful read)
- 3001 = key unprotect failed
- 3003 = persistent migration failure
- 3103 = scheduled-task script error
- 3104 = scheduled-task script dependency error
Note
Event IDs are per event type, not unique per entry.
The "Logging" tab in the desktop app lets you configure stdout and stderr logging, including size-based log rotation, date-based log rotation, the maximum number of rotated log files to retain, and additional options such as enabling debug logs.
Note
If both size-based and date-based rotation are enabled, size-based rotation takes precedence.
Note
Enabling the debug option will record sensitive information in the local log file at %ProgramData%\Servy\logs\services\<ServiceName>\Servy.Service.log. This behavior only occurs when local logging is enabled, which is the default setting. Sensitive data is never recorded in the Windows Event Log. The CLI show command and Show-ServyService mask the encrypted fields by default; --decrypt / -Decrypt prints the parameters and environment variables in clear text (the stored password always stays masked). See Servy CLI and Servy PowerShell Module.
Note
Enabling Console UI (--enableConsoleUI) disables stdout/stderr redirection at the OS level - the child process keeps an attached console handle instead of pipes. Servy cannot capture or rotate the output in that mode, so the configured --stdout / --stderr paths will remain empty. Use one or the other, not both.
-
--stdout- stdout log path -
--stderr- stderr log path --enableSizeRotation-
--rotationSize- size in MB (1-10240) --enableDateRotation-
--dateRotationType- Daily, Weekly, Monthly, None (None disables date-based rotation; use when only size rotation is desired) -
--useLocalTimeForRotation- use local time instead of UTC (default: false) -
--maxRotations- number of files, 0 = unlimited (maximum 10000) -
--debug- Enable debug logs. Records environment variables and process parameters in%ProgramData%\Servy\logs\services\<ServiceName>\Servy.Service.log. Not recommended for production.
servy-cli install `
--name="My NodeJS Service" `
--description="My NodeJS Server" `
--path="C:\Program Files\nodejs\node.exe" `
--startupDir="C:\Apps\App" `
--params="C:\Apps\App\index.js" `
--startupType="Automatic" `
--priority="Normal" `
--stdout="C:\Apps\App\stdout.log" `
--stderr="C:\Apps\App\stderr.log" `
--enableSizeRotation `
--rotationSize="10" `
--maxRotations="5" `
--debug-
-Stdout(string) -
-Stderr(string) -
-EnableSizeRotation(switch) -
-RotationSize(int) -
-EnableDateRotation(switch) -
-DateRotationType(Daily, Weekly, Monthly, None - None disables date-based rotation; use when only size rotation is desired) -
-UseLocalTimeForRotation(switch) -
-MaxRotations(int, 0 = unlimited) -
-EnableDebugLogs- Enable debug logs. Records environment variables and process parameters in%ProgramData%\Servy\logs\services\<ServiceName>\Servy.Service.log. Not recommended for production.
Import-Module "C:\Program Files\Servy\Servy.psm1" -Force
$installParams = @{
Quiet = $true
Name = "My NodeJS Service"
Description = "My NodeJS Server"
Path = "C:\Program Files\nodejs\node.exe"
StartupDir = "C:\Apps\App"
Params = "C:\Apps\App\index.js"
StartupType = "Automatic"
Priority = "Normal"
Stdout = "C:\Apps\App\stdout.log"
Stderr = "C:\Apps\App\stderr.log"
EnableSizeRotation = $true
RotationSize = 10
MaxRotations = 5
EnableDebugLogs = $true
}
Install-ServyService @installParamsServy's own log files are under %ProgramData%\Servy\logs\:
-
logs\- the logs of the Desktop App, Servy Manager,servy-cliand theServyhost service (Servy.Host.log). OnlySYSTEMandAdministratorscan read them. -
logs\services\<ServiceName>\(v10.2+) - one folder per service, holdingServy.Service.log(the service wrapper) andServy.Restarter.log. Only that service's account,SYSTEMandAdministratorscan reach it. A service name that holds a character a folder name cannot hold is percent-encoded (My:Servicelogs tologs\services\My%3AService\); see Security for the full rules.
Before v10.2, every service wrote to a single shared logs\Servy.Service.log. An upgrade leaves that file where it is, untouched; no service writes to it any more, and it can be deleted once it is no longer needed.
Tip
Combine log rotation with health monitoring and pre-launch scripts to avoid disk space issues.
Copyright © Akram El Assas. All rights reserved.
Getting Started
Core Suite
Configuration & Features
- Advanced Configuration
- Logging & Log Rotation
- Health Monitoring & Recovery
- Environment Variables
- Service Dependencies
- Export / Import Services
Lifecycle Hooks
Automation & Production
- Servy Automation & CI/CD
- Embedding in Custom Installers
- Integration with Monitoring Tools
- Service Event Notifications
- Backup / Restore & VM Cloning
Reference & Support