Skip to content
Snippets Groups Projects
Commit 856d8e10 authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Reverse components in log file names to start with the host name

Refers to #5
parent 3d0d81c5
No related branches found
No related tags found
No related merge requests found
...@@ -157,9 +157,9 @@ namespace ATxService ...@@ -157,9 +157,9 @@ namespace ATxService
var logConfig = new LoggingConfiguration(); var logConfig = new LoggingConfiguration();
var fileTarget = new FileTarget { var fileTarget = new FileTarget {
Name = "file", Name = "file",
FileName = $"var/{ServiceName}.{Environment.MachineName}.log", FileName = $"var/{Environment.MachineName}.{ServiceName}.log",
ArchiveAboveSize = 1 * Conv.MegaBytes, ArchiveAboveSize = 1 * Conv.MegaBytes,
ArchiveFileName = $"var/{ServiceName}.{Environment.MachineName}" + ".{#}.log", ArchiveFileName = $"var/{Environment.MachineName}.{ServiceName}" + ".{#}.log",
MaxArchiveFiles = 9, MaxArchiveFiles = 9,
KeepFileOpen = true, KeepFileOpen = true,
Layout = LogFormatDefault, Layout = LogFormatDefault,
......
...@@ -24,7 +24,7 @@ namespace ATxService ...@@ -24,7 +24,7 @@ namespace ATxService
var startupLog = Path.Combine( var startupLog = Path.Combine(
AppDomain.CurrentDomain.BaseDirectory, AppDomain.CurrentDomain.BaseDirectory,
"var", "var",
"startup.log"); $"{Environment.MachineName}.startup.log");
using (var sw = File.AppendText(startupLog)) using (var sw = File.AppendText(startupLog))
{ {
sw.WriteLine(ex.Message); sw.WriteLine(ex.Message);
......
...@@ -93,7 +93,7 @@ if (Test-Path $LocalConfiguration) { ...@@ -93,7 +93,7 @@ if (Test-Path $LocalConfiguration) {
Exit Exit
} }
$ServiceLog = "$($ServiceDir)\$($ServiceName).log" $ServiceLog = "$($ServiceDir)\var\$($env:COMPUTERNAME).$($ServiceName).log"
$Service = Get-Service $ServiceName -ErrorAction SilentlyContinue $Service = Get-Service $ServiceName -ErrorAction SilentlyContinue
......
...@@ -6,7 +6,7 @@ if (Test-Path $LocalConfiguration) { ...@@ -6,7 +6,7 @@ if (Test-Path $LocalConfiguration) {
Exit Exit
} }
$LogFile = "$($ServiceDir)\var\$($ServiceName).$($env:COMPUTERNAME).log" $LogFile = "$($ServiceDir)\var\$($env:COMPUTERNAME).$($ServiceName).log"
if (Test-Path $LogFile) { if (Test-Path $LogFile) {
Write-Host "Watching logfile '$LogFile':" Write-Host "Watching logfile '$LogFile':"
......
...@@ -617,7 +617,7 @@ $ServiceRunningBefore = ServiceIsRunning $ServiceName ...@@ -617,7 +617,7 @@ $ServiceRunningBefore = ServiceIsRunning $ServiceName
$ConfigPath = "$($InstallationPath)\conf" $ConfigPath = "$($InstallationPath)\conf"
$LogPath = "$($InstallationPath)\var" $LogPath = "$($InstallationPath)\var"
$LogFilePfx = "$($LogPath)\$($ServiceName).$($env:COMPUTERNAME)" $LogFilePfx = "$($LogPath)\$($env:COMPUTERNAME).$($ServiceName)"
$StatusXml = "$($InstallationPath)\var\status.xml" $StatusXml = "$($InstallationPath)\var\status.xml"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment