From e481785a849c259ae74058b776ef06cf3362ee10 Mon Sep 17 00:00:00 2001 From: Michael Krisper <michael.krisper@tugraz.at> Date: Mon, 11 Jul 2022 14:52:45 +0200 Subject: [PATCH] Corrected missing LOG in .NET 6.0. Now works for all framework versions. --- VECTO/VECTO.vbproj | 8 ++++++++ VECTO/app.config | 36 ------------------------------------ VECTO/nlog.config | 16 ++++++++++++++++ 3 files changed, 24 insertions(+), 36 deletions(-) delete mode 100644 VECTO/app.config create mode 100644 VECTO/nlog.config diff --git a/VECTO/VECTO.vbproj b/VECTO/VECTO.vbproj index 85de0a6f58..f1b4d12e4a 100644 --- a/VECTO/VECTO.vbproj +++ b/VECTO/VECTO.vbproj @@ -14,6 +14,14 @@ <DefineTrace>false</DefineTrace> <DefineConstants /> </PropertyGroup> + <ItemGroup> + <None Remove="nlog.config" /> + </ItemGroup> + <ItemGroup> + <Content Include="nlog.config"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> + </ItemGroup> <ItemGroup> <PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> diff --git a/VECTO/app.config b/VECTO/app.config deleted file mode 100644 index 49b939ba25..0000000000 --- a/VECTO/app.config +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<configuration> - <configSections> - <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" /> - </configSections> - <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd" autoReload="false" throwExceptions="false" internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log"> - <targets async="true"> - <target xsi:type="Console" name="ConsoleLogger" error="true" /> - <target name="GUILogger" xsi:type="MethodCall" className="TUGraz.VECTO.MainForm, VECTO" methodName="LogMethod"> - <parameter layout="${level}" /> - <parameter layout="${message}" /> - </target> - <target xsi:type="File" name="LogFile" fileName="${basedir}/logs/log.txt" layout="${longdate} [${processid}:${threadid}@${machinename}] ${callsite:skipFrames=1} ${level:uppercase=true}: ${message} ${exception:format=tostring}" keepFileOpen="false" archiveFileName="${basedir}/logs/archive{#}.txt" maxArchiveFiles="1" archiveAboveSize="10000000" /> - </targets> - <rules> - <logger name="TUGraz.VectoCore.Models.Simulation.Impl.SimulatorFactory" minlevel="Info" writeTo="LogFile" /> - <logger name="*" minlevel="Warn" writeTo="LogFile" /> - <logger name="*" minlevel="Warn" writeTo="GUILogger" /> - </rules> - </nlog> - <system.diagnostics> - <sources> - <source name="DefaultSource" switchName="DefaultSwitch"> - <listeners> - <add name="FileLog" /> - </listeners> - </source> - </sources> - <switches> - <add name="DefaultSwitch" value="Information" /> - </switches> - <sharedListeners> - <add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter" /> - </sharedListeners> - </system.diagnostics> -</configuration> \ No newline at end of file diff --git a/VECTO/nlog.config b/VECTO/nlog.config new file mode 100644 index 0000000000..550e301d58 --- /dev/null +++ b/VECTO/nlog.config @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd" autoReload="false" throwExceptions="false" internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log"> + <targets async="true"> + <target xsi:type="Console" name="ConsoleLogger" error="true" /> + <target name="GUILogger" xsi:type="MethodCall" className="TUGraz.VECTO.MainForm, VECTO" methodName="LogMethod"> + <parameter layout="${level}" /> + <parameter layout="${message}" /> + </target> + <target xsi:type="File" name="LogFile" fileName="${basedir}/logs/log.txt" layout="${longdate} [${processid}:${threadid}@${machinename}] ${callsite:skipFrames=1} ${level:uppercase=true}: ${message} ${exception:format=tostring}" keepFileOpen="false" archiveFileName="${basedir}/logs/archive{#}.txt" maxArchiveFiles="1" archiveAboveSize="10000000" /> + </targets> + <rules> + <logger name="TUGraz.VectoCore.Models.Simulation.Impl.SimulatorFactory" minlevel="Info" writeTo="LogFile" /> + <logger name="*" minlevel="Warn" writeTo="LogFile" /> + <logger name="*" minlevel="Warn" writeTo="GUILogger" /> + </rules> +</nlog> \ No newline at end of file -- GitLab