Skip to content

Commit 45552df

Browse files
committed
Add RD version to logging, log startup environment. Closes #2461
1 parent 3c36eda commit 45552df

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

RetailCoder.VBE/App.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
using System.IO;
1+
using System.Collections.Generic;
2+
using System.IO;
3+
using System.Reflection;
24
using Infralution.Localization.Wpf;
35
using NLog;
6+
using NLog.Fluent;
47
using Rubberduck.Common;
58
using Rubberduck.Parsing;
69
using Rubberduck.Parsing.Symbols;
@@ -145,6 +148,7 @@ private void UpdateLoggingLevel()
145148
public void Startup()
146149
{
147150
EnsureLogFolderPathExists();
151+
LogRubberduckSart();
148152
LoadConfig();
149153
CheckForLegacyIndenterSettings();
150154
_appMenus.Initialize();
@@ -223,6 +227,21 @@ private void CheckForLegacyIndenterSettings()
223227
}
224228
}
225229

230+
private void LogRubberduckSart()
231+
{
232+
var version = GetType().Assembly.GetName().Version.ToString();
233+
GlobalDiagnosticsContext.Set("RubberduckVersion", version);
234+
var headers = new List<string>
235+
{
236+
string.Format("Rubberduck version {0} loading:", version),
237+
string.Format("\tOperating System: {0} {1}", Environment.OSVersion.VersionString, Environment.Is64BitOperatingSystem ? "x64" : "x86"),
238+
string.Format("\tHost Product: {0} {1}", Application.ProductName, Environment.Is64BitProcess ? "x64" : "x86"),
239+
string.Format("\tHost Version: {0}", Application.ProductVersion),
240+
string.Format("\tHost Executable: {0}", Path.GetFileName(Application.ExecutablePath)),
241+
};
242+
Logger.Log(LogLevel.Info, string.Join(Environment.NewLine, headers));
243+
}
244+
226245
private bool _disposed;
227246
public void Dispose()
228247
{

RetailCoder.VBE/NLog.dll.nlog

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
xsi:type="File"
88
name="file"
99
fileName="${specialfolder:folder=ApplicationData}/Rubberduck/Logs/RubberduckLog.txt"
10-
layout="${longdate};${uppercase:${level}};${logger};${message};${exception:format=tostring}"
10+
layout="${longdate};${uppercase:${level}}-${gdc:item=RubberduckVersion};${logger};${message};${exception:format=tostring}"
1111
archiveFileName="${specialfolder:folder=ApplicationData}/Rubberduck/Logs/archives/RubberduckLog.{#}.txt"
1212
archiveAboveSize="5242880"
1313
archiveNumbering="Sequence"

0 commit comments

Comments
 (0)