Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
auto-tx
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vamp
auto-tx
Commits
dfbac75c
Commit
dfbac75c
authored
7 years ago
by
Niko Ehrenfeuchter
Browse files
Options
Downloads
Patches
Plain Diff
Move log files to "var/" subdir and include hostname in file name
Fixes
#5
parent
231d684c
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
ATxService/AutoTx.cs
+2
-2
2 additions, 2 deletions
ATxService/AutoTx.cs
ATxService/Program.cs
+4
-1
4 additions, 1 deletion
ATxService/Program.cs
Scripts/Watch-Logfile.ps1
+1
-1
1 addition, 1 deletion
Scripts/Watch-Logfile.ps1
Updater/Update-Service.ps1
+6
-10
6 additions, 10 deletions
Updater/Update-Service.ps1
with
13 additions
and
14 deletions
ATxService/AutoTx.cs
+
2
−
2
View file @
dfbac75c
...
...
@@ -157,9 +157,9 @@ namespace ATxService
var
logConfig
=
new
LoggingConfiguration
();
var
fileTarget
=
new
FileTarget
{
Name
=
"file"
,
FileName
=
ServiceName
+
"
.log"
,
FileName
=
$"var/
{
ServiceName
}
.
{
Environment
.
MachineName
}
.log"
,
ArchiveAboveSize
=
1
*
Conv
.
MegaBytes
,
ArchiveFileName
=
ServiceName
+
".{#}.log"
,
ArchiveFileName
=
$"var/
{
ServiceName
}
.
{
Environment
.
MachineName
}
"
+
".{#}.log"
,
MaxArchiveFiles
=
9
,
KeepFileOpen
=
true
,
Layout
=
LogFormatDefault
,
...
...
This diff is collapsed.
Click to expand it.
ATxService/Program.cs
+
4
−
1
View file @
dfbac75c
...
...
@@ -21,7 +21,10 @@ namespace ATxService
}
catch
(
Exception
ex
)
{
var
startupLog
=
Path
.
Combine
(
AppDomain
.
CurrentDomain
.
BaseDirectory
,
"startup.log"
);
var
startupLog
=
Path
.
Combine
(
AppDomain
.
CurrentDomain
.
BaseDirectory
,
"var"
,
"startup.log"
);
using
(
var
sw
=
File
.
AppendText
(
startupLog
))
{
sw
.
WriteLine
(
ex
.
Message
);
...
...
This diff is collapsed.
Click to expand it.
Scripts/Watch-Logfile.ps1
+
1
−
1
View file @
dfbac75c
...
...
@@ -6,7 +6,7 @@ if (Test-Path $LocalConfiguration) {
Exit
}
$LogFile
=
$ServiceDir
+
"\AutoTx
.log"
$LogFile
=
"
$(
$ServiceDir
)
\var\
$(
$ServiceName
)
.
$(
$
env
:
COMPUTERNAME
)
.log"
if
(
Test-Path
$LogFile
)
{
Write-Host
"Watching logfile '
$LogFile
':"
...
...
This diff is collapsed.
Click to expand it.
Updater/Update-Service.ps1
+
6
−
10
View file @
dfbac75c
...
...
@@ -159,7 +159,7 @@ function Start-MyService {
$ex
=
$_
.
Exception
.
Message
$msg
=
"Trying to start the service results in this error:
`n
$(
$ex
)
`n`n
"
$msg
+=
" -------------------- last 50 log lines --------------------
`n
"
$msg
+=
Get-LastLogLines
"
$(
$LogFile
)
"
50
$msg
+=
Get-LastLogLines
"
$(
$LogFile
Pfx
)
.log
"
50
$msg
+=
" -------------------- ----------------- --------------------
`n
"
Send-MailReport
-Subject
"Startup of service
$(
$ServiceName
)
failed!"
`
-Body
$msg
...
...
@@ -450,16 +450,12 @@ function ServiceUpdate-Requested {
function
Upload
-LogFiles
{
$Dest
=
"
$(
$UploadPathLogs
)
\
$(
$
env
:
COMPUTERNAME
)
"
New-Item
-Force
-Type
Directory
$Dest
|
Out-Null
try
{
Copy-Item
-Force
-ErrorAction
Stop
`
-Path
"
$(
$LogFile
)
"
`
-Destination
$Dest
Log-Debug
"Uploaded logfile to [
$(
$Dest
)
]."
Copy-Item
-Force
-Path
"
$(
$LogFilePfx
)
*.log"
-Destination
$UploadPathLogs
Log-Debug
"Uploaded logfile(s) to [
$(
$UploadPathLogs
)
]."
}
catch
{
Log-Warning
"Uploading logfile FAILED!
`n
$(
$_
.
Exception
.
Message
)
"
Log-Warning
"Uploading logfile
(s)
FAILED!
`n
$(
$_
.
Exception
.
Message
)
"
}
}
...
...
@@ -589,8 +585,8 @@ Log-Debug "$($Me) started..."
$ServiceRunningBefore
=
ServiceIsRunning
$ServiceName
$ConfigPath
=
"
$(
$InstallationPath
)
\conf"
$LogPath
=
"
$(
$InstallationPath
)
"
$LogFile
=
"
$(
$LogPath
)
\
AutoTx.log
"
$LogPath
=
"
$(
$InstallationPath
)
\var
"
$LogFile
Pfx
=
"
$(
$LogPath
)
\
$(
$ServiceName
)
.
$(
$
env
:
COMPUTERNAME
)
"
$StatusXml
=
"
$(
$InstallationPath
)
\var\status.xml"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment