Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 5de119c6 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

change nlog log path if mode is set to installed

parent fa63a57f
Branches
Tags
No related merge requests found
......@@ -12,9 +12,13 @@ Imports System.Collections.Generic
Imports System.IO
Imports System.Linq
Imports System.Text
Imports NLog
Imports NLog.Targets
Imports NLog.Targets.Wrappers
Imports TUGraz.VectoCommon.Utils
Imports TUGraz.VectoCore.Utils
Namespace My
' The following events are available for MyApplication:
'
......@@ -46,9 +50,20 @@ Namespace My
ReadInstallMode()
MyConfPath = path.Combine(MyAppPath, CONFIG_FOLDER)
MyLogPath = ""
if (InstallModeInstalled) Then
MyConfPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), APP_DATA_VENDOR_PATH, VectoSimulationCore.VersionNumber, CONFIG_FOLDER)
MyLogPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), APP_DATA_VENDOR_PATH, VectoSimulationCore.VersionNumber)
Dim logTarget As FileTarget = TryCast(LogManager.Configuration.FindTargetByName("LogFile"), FileTarget)
if (logTarget is Nothing) Then
logTarget = CType(TryCast(LogManager.Configuration.FindTargetByName("LogFile"), WrapperTargetBase).WrappedTarget, FileTarget)
End If
if (Not (logTarget Is Nothing)) then
logTarget.FileName = Path.Combine(MyLogPath, "logs", "log.txt")
LogManager.ReconfigExistingLoggers()
End If
End If
FileHistoryPath = path.Combine(MyConfPath, CONFIG_FILE_HISTORY_FOLDER)
......@@ -56,7 +71,7 @@ Namespace My
'If folder does not exist: Create!
If Not Directory.Exists(MyLogPath) Then
If Not String.IsNullOrWhiteSpace(MyLogPath) AndAlso Not Directory.Exists(MyLogPath) Then
Try
Directory.CreateDirectory(MyLogPath)
Catch ex As Exception
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment