From a69e5ca1af244d599eaa840c25fddaf62072aa05 Mon Sep 17 00:00:00 2001 From: Duane McKinney Date: Sat, 14 May 2016 14:01:29 -0700 Subject: [PATCH 01/16] Saved project in visual Studio 2015. Added dummy missing icons. Created from Syncfusion metro studio icons. Added missing app.config for TestNlog. Changed Log4Net to be gotten from Nuget. --- src/Log2Console/Log2Console.csproj | 8 +++---- src/Log2Console/res/collapse_all.png | Bin 0 -> 211 bytes src/Log2Console/res/pin.png | Bin 0 -> 237 bytes src/Log2Console/res/unselect.png | Bin 0 -> 181 bytes src/LogFmwk.sln | 30 +++++---------------------- src/Test/Test.csproj | 4 ++-- src/Test/packages.config | 4 ++++ src/TestNLog/app.config | 6 ++++++ 8 files changed, 21 insertions(+), 31 deletions(-) create mode 100644 src/Log2Console/res/collapse_all.png create mode 100644 src/Log2Console/res/pin.png create mode 100644 src/Log2Console/res/unselect.png create mode 100644 src/Test/packages.config create mode 100644 src/TestNLog/app.config diff --git a/src/Log2Console/Log2Console.csproj b/src/Log2Console/Log2Console.csproj index 22babe0..d413251 100644 --- a/src/Log2Console/Log2Console.csproj +++ b/src/Log2Console/Log2Console.csproj @@ -77,10 +77,6 @@ false - - ..\packages\ICSharpCode.TextEditor.3.2.1.6466\lib\Net20\ICSharpCode.TextEditor.dll - True - False ..\External\log4net.dll @@ -274,6 +270,10 @@ + + {2d18be89-d210-49eb-a9dd-2246fbb3df6d} + ICSharpCode.TextEditor + {8B833B00-BB4C-4FAF-B6C4-BF77824F96A1} RichTextBoxLinks diff --git a/src/Log2Console/res/collapse_all.png b/src/Log2Console/res/collapse_all.png new file mode 100644 index 0000000000000000000000000000000000000000..1674422b037e17a0cef092898340ef477639f040 GIT binary patch literal 211 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1quc!3<9q#}EtuWC>QDo&YJndH;TWm-C2i_+Ze` zXd*pXVM?zo1Mdy~)Fg(SBA$N`R}h71AB+yc)TX4*I0km-n?Ib+7Vh9@0N4(aU-AM+IA z_>WixB=R(z=N50MP!{;lQ1y^EqD6#Z%T@Lc+XXR~7%seLa=63rbP`{KS$hLdW05;! d+<^lO3`be4D=r>n&jz}N!PC{xWt~$(699k-PNV<; literal 0 HcmV?d00001 diff --git a/src/Log2Console/res/unselect.png b/src/Log2Console/res/unselect.png new file mode 100644 index 0000000000000000000000000000000000000000..67c442b0b6dad330e825d2214ee5a4eed1e808ad GIT binary patch literal 181 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qucK`&1i#}EtuWC>QDo&YJnfB*l-GcK`EunA$9 zlAM;5w5qjeBlChqEE>Yh36qnXE~PXFGH-BCW}Z;R@Ngm1f;mtTMI$ literal 0 HcmV?d00001 diff --git a/src/LogFmwk.sln b/src/LogFmwk.sln index 5669cbe..1f2a906 100644 --- a/src/LogFmwk.sln +++ b/src/LogFmwk.sln @@ -1,6 +1,8 @@  -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25123.0 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{29A745D4-5A2F-4170-A0F1-54C77F151892}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Log2Console", "Log2Console\Log2Console.csproj", "{EE81C506-55E4-417E-B1D6-09453F89C7CD}" @@ -20,29 +22,6 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RichTextBoxLinks", "RichTextBoxLinks\RichTextBoxLinks.csproj", "{8B833B00-BB4C-4FAF-B6C4-BF77824F96A1}" EndProject Global - GlobalSection(TeamFoundationVersionControl) = preSolution - SccNumberOfProjects = 6 - SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} - SccTeamFoundationServer = https://tfs.codeplex.com/tfs/tfs04 - SccLocalPath0 = . - SccProjectUniqueName1 = Log2Console\\Log2Console.csproj - SccProjectName1 = Log2Console - SccLocalPath1 = Log2Console - SccProjectUniqueName2 = Test\\Test.csproj - SccProjectName2 = Test - SccLocalPath2 = Test - SccProjectUniqueName3 = L2C_Setup\\L2C_Setup.vdproj - SccProjectName3 = L2C_Setup - SccLocalPath3 = L2C_Setup - SccProjectUniqueName4 = External\\WindowsAPICodePack\\Core\\Core.csproj - SccProjectTopLevelParentUniqueName4 = LogFmwk.sln - SccProjectName4 = External/WindowsAPICodePack/Core - SccLocalPath4 = External\\WindowsAPICodePack\\Core - SccProjectUniqueName5 = External\\WindowsAPICodePack\\Shell\\Shell.csproj - SccProjectTopLevelParentUniqueName5 = LogFmwk.sln - SccProjectName5 = External/WindowsAPICodePack/Shell - SccLocalPath5 = External\\WindowsAPICodePack\\Shell - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution CodeAnalysisDebug|Any CPU = CodeAnalysisDebug|Any CPU Debug|Any CPU = Debug|Any CPU @@ -80,6 +59,7 @@ Global {7C4E8E11-81E3-4297-A4D9-6F6DB90C8EF7}.CodeAnalysisDebug|Any CPU.ActiveCfg = Debug|Any CPU {7C4E8E11-81E3-4297-A4D9-6F6DB90C8EF7}.CodeAnalysisDebug|Any CPU.Build.0 = Debug|Any CPU {7C4E8E11-81E3-4297-A4D9-6F6DB90C8EF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7C4E8E11-81E3-4297-A4D9-6F6DB90C8EF7}.Debug|Any CPU.Build.0 = Debug|Any CPU {7C4E8E11-81E3-4297-A4D9-6F6DB90C8EF7}.Release|Any CPU.ActiveCfg = Release|Any CPU {2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}.CodeAnalysisDebug|Any CPU.ActiveCfg = Debug|Any CPU {2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}.CodeAnalysisDebug|Any CPU.Build.0 = Debug|Any CPU diff --git a/src/Test/Test.csproj b/src/Test/Test.csproj index 8b53006..9ace27a 100644 --- a/src/Test/Test.csproj +++ b/src/Test/Test.csproj @@ -58,8 +58,8 @@ AllRules.ruleset - - ..\packages\log4net.2.0.3\lib\net40-full\log4net.dll + + ..\packages\log4net.2.0.5\lib\net40-full\log4net.dll True diff --git a/src/Test/packages.config b/src/Test/packages.config new file mode 100644 index 0000000..b8fa84f --- /dev/null +++ b/src/Test/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/TestNLog/app.config b/src/TestNLog/app.config new file mode 100644 index 0000000..c24356f --- /dev/null +++ b/src/TestNLog/app.config @@ -0,0 +1,6 @@ + + + + + + From 41a15eb7a655639ccee7dab467986ca88565c124 Mon Sep 17 00:00:00 2001 From: Duane McKinney Date: Sat, 14 May 2016 14:14:37 -0700 Subject: [PATCH 02/16] Fix http://log2console.codeplex.com/workitem/17658 Replace \r\n or \n with \line --- src/Log2Console/Log/LogMessage.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Log2Console/Log/LogMessage.cs b/src/Log2Console/Log/LogMessage.cs index 487a38b..9e2ed07 100644 --- a/src/Log2Console/Log/LogMessage.cs +++ b/src/Log2Console/Log/LogMessage.cs @@ -167,6 +167,8 @@ public string GetMessageDetails() sb.Append(@"\b " + fieldType.Field + @": \b0 "); if (info.Length > 40) sb.Append(@" \line "); + info = info.Replace("\r\n", @" \line "); + info = info.Replace("\n", @" \line "); sb.Append(info + @" \line "); } sb.Append(@"}"); From f07f031ec0ce3043cfeed9893943fb2803977c38 Mon Sep 17 00:00:00 2001 From: Duane McKinney Date: Sat, 14 May 2016 15:59:39 -0700 Subject: [PATCH 03/16] Processes multiple log entries over the same connection. Will create a log entry with any exception thrown. Would like to be able to capture the raw log and return that on a parser exception. --- src/Log2Console/Receiver/ReceiverUtils.cs | 51 +++++++++++++- src/Log2Console/Receiver/TcpReceiver.cs | 19 +++-- src/LogFmwk.sln | 44 ++++++++---- src/{ => Tests}/Test/App.config | 0 src/{ => Tests}/Test/MsmqAppender.cs | 0 src/{ => Tests}/Test/Program.cs | 3 + .../Test/Properties/AssemblyInfo.cs | 0 src/{ => Tests}/Test/Test.csproj | 0 src/{ => Tests}/Test/Test.csproj.vspscc | 0 src/{ => Tests}/Test/packages.config | 0 src/{ => Tests}/TestNLog/NLog.config | 0 src/{ => Tests}/TestNLog/Program.cs | 33 ++++++--- src/{ => Tests}/TestNLog/TestNLog.csproj | 7 +- src/{ => Tests}/TestNLog/app.config | 0 src/Tests/TestNLog/packages.config | 4 ++ src/Tests/TestOther/App.config | 6 ++ src/Tests/TestOther/Program.cs | 70 +++++++++++++++++++ .../TestOther/Properties/AssemblyInfo.cs | 36 ++++++++++ src/Tests/TestOther/TestOther.csproj | 59 ++++++++++++++++ 19 files changed, 295 insertions(+), 37 deletions(-) rename src/{ => Tests}/Test/App.config (100%) rename src/{ => Tests}/Test/MsmqAppender.cs (100%) rename src/{ => Tests}/Test/Program.cs (91%) rename src/{ => Tests}/Test/Properties/AssemblyInfo.cs (100%) rename src/{ => Tests}/Test/Test.csproj (100%) rename src/{ => Tests}/Test/Test.csproj.vspscc (100%) rename src/{ => Tests}/Test/packages.config (100%) rename src/{ => Tests}/TestNLog/NLog.config (100%) rename src/{ => Tests}/TestNLog/Program.cs (76%) rename src/{ => Tests}/TestNLog/TestNLog.csproj (91%) rename src/{ => Tests}/TestNLog/app.config (100%) create mode 100644 src/Tests/TestNLog/packages.config create mode 100644 src/Tests/TestOther/App.config create mode 100644 src/Tests/TestOther/Program.cs create mode 100644 src/Tests/TestOther/Properties/AssemblyInfo.cs create mode 100644 src/Tests/TestOther/TestOther.csproj diff --git a/src/Log2Console/Receiver/ReceiverUtils.cs b/src/Log2Console/Receiver/ReceiverUtils.cs index 3ad837b..9b47884 100644 --- a/src/Log2Console/Receiver/ReceiverUtils.cs +++ b/src/Log2Console/Receiver/ReceiverUtils.cs @@ -1,5 +1,6 @@ using Log2Console.Log; using System; +using System.Collections.Generic; using System.ComponentModel; using System.IO; using System.Text; @@ -24,7 +25,7 @@ public static string GetTypeDescription(Type type) static XmlReaderSettings CreateSettings() { - return new XmlReaderSettings { CloseInput = false, ValidationType = ValidationType.None }; + return new XmlReaderSettings { CloseInput = false, ValidationType = ValidationType.None, ConformanceLevel = ConformanceLevel.Fragment }; } /// @@ -53,6 +54,49 @@ public static LogMessage ParseLog4JXmlLogEvent(Stream logStream, string defaultL return ParseLog4JXmlLogEvent(reader, defaultLogger); } + public static IEnumerable ParseLog4JXmlLogEvents(Stream logStream, string defaultLogger) + { + // In case of ungraceful disconnect + // logStream is closed and XmlReader throws the exception, + // which we handle in TcpReceiver + using (var reader = XmlReader.Create(logStream, XmlSettings, XmlContext)) + { + while (!reader.EOF) + { + if(reader.NodeType == XmlNodeType.Element && reader.Name == "log4j:event") + { + LogMessage logMessage = null; + string logEntry = ""; + try + { + logEntry = reader.ReadOuterXml(); + byte[] buffer = Encoding.UTF8.GetBytes(logEntry); + MemoryStream ms = new MemoryStream(buffer); + logMessage = ParseLog4JXmlLogEvent(ms, defaultLogger); + } + catch(Exception e) + { + logMessage = new LogMessage() + { + LoggerName = defaultLogger, + RootLoggerName = defaultLogger, + ThreadName = "NA", + Message = "Error parsing log" + Environment.NewLine + logEntry, + TimeStamp = DateTime.Now, + Level = LogLevels.Instance[LogLevel.Info], + ExceptionString = e.Message + }; + } + yield return logMessage; + } + else + { + reader.Read(); + } + } + } + } + /// /// Parse LOG4JXml from string /// @@ -99,7 +143,10 @@ public static LogMessage ParseLog4JXmlLogEvent(XmlReader reader, string defaultL { var logMsg = new LogMessage(); - reader.Read(); + while (!reader.EOF && (reader.NodeType != XmlNodeType.Element || reader.Name != "log4j:event")) + { + reader.Read(); + } if ((reader.MoveToContent() != XmlNodeType.Element) || (reader.Name != "log4j:event")) throw new Exception("The Log Event is not a valid log4j Xml block."); diff --git a/src/Log2Console/Receiver/TcpReceiver.cs b/src/Log2Console/Receiver/TcpReceiver.cs index ba98b08..d5e80f9 100644 --- a/src/Log2Console/Receiver/TcpReceiver.cs +++ b/src/Log2Console/Receiver/TcpReceiver.cs @@ -99,21 +99,26 @@ void Start(object newSocket) using (var ns = new NetworkStream(socket, FileAccess.Read, false)) while (_socket != null) { - var logMsg = ReceiverUtils.ParseLog4JXmlLogEvent(ns, "TcpLogger"); - logMsg.RootLoggerName = logMsg.LoggerName; - logMsg.LoggerName = string.Format(":{1}.{0}", logMsg.LoggerName, _port); - - if (Notifiable != null) - Notifiable.Notify(logMsg); + var logMessages = ReceiverUtils.ParseLog4JXmlLogEvents(ns, "TcpLogger"); + foreach (var logMessage in logMessages) + { + logMessage.RootLoggerName = logMessage.LoggerName; + logMessage.LoggerName = string.Format(":{1}.{0}", logMessage.LoggerName, _port); + + if (Notifiable != null) + Notifiable.Notify(logMessage); + } } } - catch (IOException) + catch (IOException e) { + Console.WriteLine(e); } catch (Exception e) { Console.WriteLine(e); } + Console.WriteLine("Connection closed"); } public override void Terminate() diff --git a/src/LogFmwk.sln b/src/LogFmwk.sln index 1f2a906..8f5ea4c 100644 --- a/src/LogFmwk.sln +++ b/src/LogFmwk.sln @@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 VisualStudioVersion = 14.0.25123.0 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{29A745D4-5A2F-4170-A0F1-54C77F151892}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Log2Console", "Log2Console\Log2Console.csproj", "{EE81C506-55E4-417E-B1D6-09453F89C7CD}" EndProject Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "L2C_Setup", "L2C_Setup\L2C_Setup.vdproj", "{19438485-B918-42F2-8DC7-F352D24AC55E}" @@ -15,12 +13,18 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core", "External\WindowsAPI EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shell", "External\WindowsAPICodePack\Shell\Shell.csproj", "{AA0C00CB-8699-4F37-BFAE-40CA87ACC06D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestNLog", "TestNLog\TestNLog.csproj", "{7C4E8E11-81E3-4297-A4D9-6F6DB90C8EF7}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.TextEditor", "ICSharpCode.TextEditor\ICSharpCode.TextEditor.csproj", "{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RichTextBoxLinks", "RichTextBoxLinks\RichTextBoxLinks.csproj", "{8B833B00-BB4C-4FAF-B6C4-BF77824F96A1}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{8E1F6F4D-8276-4FCB-B2FB-11CDE072BEE2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestOther", "Tests\TestOther\TestOther.csproj", "{8B2E0489-1A71-47A6-BB28-2D66C3541BDC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Tests\Test\Test.csproj", "{29A745D4-5A2F-4170-A0F1-54C77F151892}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestNLog", "Tests\TestNLog\TestNLog.csproj", "{7C4E8E11-81E3-4297-A4D9-6F6DB90C8EF7}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution CodeAnalysisDebug|Any CPU = CodeAnalysisDebug|Any CPU @@ -28,12 +32,6 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {29A745D4-5A2F-4170-A0F1-54C77F151892}.CodeAnalysisDebug|Any CPU.ActiveCfg = Debug|Any CPU - {29A745D4-5A2F-4170-A0F1-54C77F151892}.CodeAnalysisDebug|Any CPU.Build.0 = Debug|Any CPU - {29A745D4-5A2F-4170-A0F1-54C77F151892}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {29A745D4-5A2F-4170-A0F1-54C77F151892}.Debug|Any CPU.Build.0 = Debug|Any CPU - {29A745D4-5A2F-4170-A0F1-54C77F151892}.Release|Any CPU.ActiveCfg = Release|Any CPU - {29A745D4-5A2F-4170-A0F1-54C77F151892}.Release|Any CPU.Build.0 = Release|Any CPU {EE81C506-55E4-417E-B1D6-09453F89C7CD}.CodeAnalysisDebug|Any CPU.ActiveCfg = Debug|Any CPU {EE81C506-55E4-417E-B1D6-09453F89C7CD}.CodeAnalysisDebug|Any CPU.Build.0 = Debug|Any CPU {EE81C506-55E4-417E-B1D6-09453F89C7CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU @@ -56,11 +54,6 @@ Global {AA0C00CB-8699-4F37-BFAE-40CA87ACC06D}.Debug|Any CPU.Build.0 = Debug|Any CPU {AA0C00CB-8699-4F37-BFAE-40CA87ACC06D}.Release|Any CPU.ActiveCfg = Release|Any CPU {AA0C00CB-8699-4F37-BFAE-40CA87ACC06D}.Release|Any CPU.Build.0 = Release|Any CPU - {7C4E8E11-81E3-4297-A4D9-6F6DB90C8EF7}.CodeAnalysisDebug|Any CPU.ActiveCfg = Debug|Any CPU - {7C4E8E11-81E3-4297-A4D9-6F6DB90C8EF7}.CodeAnalysisDebug|Any CPU.Build.0 = Debug|Any CPU - {7C4E8E11-81E3-4297-A4D9-6F6DB90C8EF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7C4E8E11-81E3-4297-A4D9-6F6DB90C8EF7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7C4E8E11-81E3-4297-A4D9-6F6DB90C8EF7}.Release|Any CPU.ActiveCfg = Release|Any CPU {2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}.CodeAnalysisDebug|Any CPU.ActiveCfg = Debug|Any CPU {2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}.CodeAnalysisDebug|Any CPU.Build.0 = Debug|Any CPU {2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU @@ -73,6 +66,24 @@ Global {8B833B00-BB4C-4FAF-B6C4-BF77824F96A1}.Debug|Any CPU.Build.0 = Debug|Any CPU {8B833B00-BB4C-4FAF-B6C4-BF77824F96A1}.Release|Any CPU.ActiveCfg = Release|Any CPU {8B833B00-BB4C-4FAF-B6C4-BF77824F96A1}.Release|Any CPU.Build.0 = Release|Any CPU + {8B2E0489-1A71-47A6-BB28-2D66C3541BDC}.CodeAnalysisDebug|Any CPU.ActiveCfg = Debug|Any CPU + {8B2E0489-1A71-47A6-BB28-2D66C3541BDC}.CodeAnalysisDebug|Any CPU.Build.0 = Debug|Any CPU + {8B2E0489-1A71-47A6-BB28-2D66C3541BDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8B2E0489-1A71-47A6-BB28-2D66C3541BDC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8B2E0489-1A71-47A6-BB28-2D66C3541BDC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8B2E0489-1A71-47A6-BB28-2D66C3541BDC}.Release|Any CPU.Build.0 = Release|Any CPU + {29A745D4-5A2F-4170-A0F1-54C77F151892}.CodeAnalysisDebug|Any CPU.ActiveCfg = Debug|Any CPU + {29A745D4-5A2F-4170-A0F1-54C77F151892}.CodeAnalysisDebug|Any CPU.Build.0 = Debug|Any CPU + {29A745D4-5A2F-4170-A0F1-54C77F151892}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {29A745D4-5A2F-4170-A0F1-54C77F151892}.Debug|Any CPU.Build.0 = Debug|Any CPU + {29A745D4-5A2F-4170-A0F1-54C77F151892}.Release|Any CPU.ActiveCfg = Release|Any CPU + {29A745D4-5A2F-4170-A0F1-54C77F151892}.Release|Any CPU.Build.0 = Release|Any CPU + {7C4E8E11-81E3-4297-A4D9-6F6DB90C8EF7}.CodeAnalysisDebug|Any CPU.ActiveCfg = Debug|Any CPU + {7C4E8E11-81E3-4297-A4D9-6F6DB90C8EF7}.CodeAnalysisDebug|Any CPU.Build.0 = Debug|Any CPU + {7C4E8E11-81E3-4297-A4D9-6F6DB90C8EF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7C4E8E11-81E3-4297-A4D9-6F6DB90C8EF7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7C4E8E11-81E3-4297-A4D9-6F6DB90C8EF7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7C4E8E11-81E3-4297-A4D9-6F6DB90C8EF7}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -80,5 +91,8 @@ Global GlobalSection(NestedProjects) = preSolution {2E1FB0DF-F9BB-4909-9F32-2D9D022A8E57} = {3E29A216-D8DA-4858-9EB0-D9C0C565C50B} {AA0C00CB-8699-4F37-BFAE-40CA87ACC06D} = {3E29A216-D8DA-4858-9EB0-D9C0C565C50B} + {8B2E0489-1A71-47A6-BB28-2D66C3541BDC} = {8E1F6F4D-8276-4FCB-B2FB-11CDE072BEE2} + {29A745D4-5A2F-4170-A0F1-54C77F151892} = {8E1F6F4D-8276-4FCB-B2FB-11CDE072BEE2} + {7C4E8E11-81E3-4297-A4D9-6F6DB90C8EF7} = {8E1F6F4D-8276-4FCB-B2FB-11CDE072BEE2} EndGlobalSection EndGlobal diff --git a/src/Test/App.config b/src/Tests/Test/App.config similarity index 100% rename from src/Test/App.config rename to src/Tests/Test/App.config diff --git a/src/Test/MsmqAppender.cs b/src/Tests/Test/MsmqAppender.cs similarity index 100% rename from src/Test/MsmqAppender.cs rename to src/Tests/Test/MsmqAppender.cs diff --git a/src/Test/Program.cs b/src/Tests/Test/Program.cs similarity index 91% rename from src/Test/Program.cs rename to src/Tests/Test/Program.cs index 11e26d4..006e642 100644 --- a/src/Test/Program.cs +++ b/src/Tests/Test/Program.cs @@ -22,11 +22,14 @@ class Program static void Main(string[] args) { + Console.Title = "TestLog4Net"; + Console.WriteLine("Press x to exit, any other key to run test"); ConsoleKeyInfo key = Console.ReadKey(); while (key.Key != ConsoleKey.X) { DoLog(); DoWinDebug(); + Console.WriteLine("Press x to exit, any other key to run test"); key = Console.ReadKey(); } } diff --git a/src/Test/Properties/AssemblyInfo.cs b/src/Tests/Test/Properties/AssemblyInfo.cs similarity index 100% rename from src/Test/Properties/AssemblyInfo.cs rename to src/Tests/Test/Properties/AssemblyInfo.cs diff --git a/src/Test/Test.csproj b/src/Tests/Test/Test.csproj similarity index 100% rename from src/Test/Test.csproj rename to src/Tests/Test/Test.csproj diff --git a/src/Test/Test.csproj.vspscc b/src/Tests/Test/Test.csproj.vspscc similarity index 100% rename from src/Test/Test.csproj.vspscc rename to src/Tests/Test/Test.csproj.vspscc diff --git a/src/Test/packages.config b/src/Tests/Test/packages.config similarity index 100% rename from src/Test/packages.config rename to src/Tests/Test/packages.config diff --git a/src/TestNLog/NLog.config b/src/Tests/TestNLog/NLog.config similarity index 100% rename from src/TestNLog/NLog.config rename to src/Tests/TestNLog/NLog.config diff --git a/src/TestNLog/Program.cs b/src/Tests/TestNLog/Program.cs similarity index 76% rename from src/TestNLog/Program.cs rename to src/Tests/TestNLog/Program.cs index aa74b1b..de5b2a0 100644 --- a/src/TestNLog/Program.cs +++ b/src/Tests/TestNLog/Program.cs @@ -8,18 +8,22 @@ class Program { static readonly Logger _log = LogManager.GetCurrentClassLogger(); - static void Main(string[] args) - { - var key = Console.ReadKey(); - while (key.Key != ConsoleKey.X) - { - DoLog(); - DoWinDebug(); - key = Console.ReadKey(); - } + static void Main(string[] args) + { + Console.Title = "TestNLog"; + Console.WriteLine("Press x to exit, any other to run tests."); + var key = Console.ReadKey(); + while (key.Key != ConsoleKey.X) + { + DoLog(); + DoWinDebug(); + Console.WriteLine("Press x to exit, any other to run tests."); + key = Console.ReadKey(); + } - } + + } static void DoWinDebug() { @@ -55,6 +59,15 @@ static void DoLog() _log.Warn("This is a message on many lines...\nlines...\nlines...\nlines..."); _log.Warn("This is a message on many lines...\r\nlines...\r\nlines...\r\nlines..."); + try + { + throw new Exception("Truly exceptional!"); + } + catch(Exception ex) + { + _log.Error(ex, "Exception with stack trace"); + } + var dm = new DummyManager(); dm.DoIt(); diff --git a/src/TestNLog/TestNLog.csproj b/src/Tests/TestNLog/TestNLog.csproj similarity index 91% rename from src/TestNLog/TestNLog.csproj rename to src/Tests/TestNLog/TestNLog.csproj index 4da9938..360c84b 100644 --- a/src/TestNLog/TestNLog.csproj +++ b/src/Tests/TestNLog/TestNLog.csproj @@ -47,9 +47,9 @@ true - - False - ..\external\NLog.dll + + ..\packages\NLog.4.3.3\lib\net40\NLog.dll + True @@ -61,6 +61,7 @@ PreserveNewest + diff --git a/src/TestNLog/app.config b/src/Tests/TestNLog/app.config similarity index 100% rename from src/TestNLog/app.config rename to src/Tests/TestNLog/app.config diff --git a/src/Tests/TestNLog/packages.config b/src/Tests/TestNLog/packages.config new file mode 100644 index 0000000..77eb61a --- /dev/null +++ b/src/Tests/TestNLog/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/Tests/TestOther/App.config b/src/Tests/TestOther/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/src/Tests/TestOther/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/Tests/TestOther/Program.cs b/src/Tests/TestOther/Program.cs new file mode 100644 index 0000000..5d68e3d --- /dev/null +++ b/src/Tests/TestOther/Program.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Net.Sockets; + +namespace TestOther +{ + class Program + { + const string logBody = +@" + {0} + + + + +"; + + /// + /// Make sure NLog can gracefully handle partial messages, malformed messages, etc + /// http://www.w3schools.com/xml/xml_syntax.asp + /// + /// + static void Main(string[] args) + { + Console.WriteLine("x to exit, anything else to continue"); + var key = Console.ReadKey(); + while (key.Key != ConsoleKey.X) + { + using (TcpClient client = new TcpClient("localhost", 4505)) + { + var stream = client.GetStream(); + + SendLogMessage(stream, "Extra text in open", + logBody.Replace("", "")); + + SendLogMessage(stream, "Normal Message"); + + SendLogMessage(stream, "Warn message", + logBody.Replace("level=\"INFO\"", "level=\"WARN\"")); + + SendLogMessage(stream, "comments", + "" + logBody); + + SendLogMessage(stream, "Extra spaces in open", + logBody.Replace("", "")); + + SendLogMessage(stream, "Extra spaces in close", + logBody.Replace("", "")); + + SendLogMessage(stream, "Done with Test messages"); + + //stream.Flush(); + stream.Close(); + } + Console.WriteLine("x to exit, anything else to continue"); + key = Console.ReadKey(); + } + } + + static void SendLogMessage(NetworkStream stream, string logMessage, string logBody = logBody) + { + Console.WriteLine(logMessage); + byte[] buffer = Encoding.UTF8.GetBytes(String.Format(logBody, logMessage)); + stream.Write(buffer, 0, buffer.Length); + } + } +} diff --git a/src/Tests/TestOther/Properties/AssemblyInfo.cs b/src/Tests/TestOther/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..133463c --- /dev/null +++ b/src/Tests/TestOther/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("TestOther")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("TestOther")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("8b2e0489-1a71-47a6-bb28-2d66c3541bdc")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Tests/TestOther/TestOther.csproj b/src/Tests/TestOther/TestOther.csproj new file mode 100644 index 0000000..29f55e2 --- /dev/null +++ b/src/Tests/TestOther/TestOther.csproj @@ -0,0 +1,59 @@ + + + + + Debug + AnyCPU + {8B2E0489-1A71-47A6-BB28-2D66C3541BDC} + Exe + Properties + TestOther + TestOther + v4.5 + 512 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 8ce1f7e91d32778528f6da41e1b992a9147cc22e Mon Sep 17 00:00:00 2001 From: Duane McKinney Date: Sat, 14 May 2016 22:37:26 -0700 Subject: [PATCH 04/16] Updated version number. Reinstalled test nuget packages. --- src/Log2Console/Properties/AssemblyInfo.cs | 4 ++-- src/Tests/Test/Test.csproj | 2 +- src/Tests/TestNLog/TestNLog.csproj | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Log2Console/Properties/AssemblyInfo.cs b/src/Log2Console/Properties/AssemblyInfo.cs index ba7f7db..579161b 100644 --- a/src/Log2Console/Properties/AssemblyInfo.cs +++ b/src/Log2Console/Properties/AssemblyInfo.cs @@ -28,5 +28,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("1.6.0.2")] -[assembly: AssemblyFileVersion("1.6.0.2")] +[assembly: AssemblyVersion("1.6.0.3")] +[assembly: AssemblyFileVersion("1.6.0.3")] diff --git a/src/Tests/Test/Test.csproj b/src/Tests/Test/Test.csproj index 9ace27a..fe20990 100644 --- a/src/Tests/Test/Test.csproj +++ b/src/Tests/Test/Test.csproj @@ -59,7 +59,7 @@ - ..\packages\log4net.2.0.5\lib\net40-full\log4net.dll + ..\..\packages\log4net.2.0.5\lib\net40-full\log4net.dll True diff --git a/src/Tests/TestNLog/TestNLog.csproj b/src/Tests/TestNLog/TestNLog.csproj index 360c84b..3278da4 100644 --- a/src/Tests/TestNLog/TestNLog.csproj +++ b/src/Tests/TestNLog/TestNLog.csproj @@ -48,7 +48,7 @@ - ..\packages\NLog.4.3.3\lib\net40\NLog.dll + ..\..\packages\NLog.4.3.3\lib\net40\NLog.dll True From fb000c0a97c6762b619d213022ddc750bd9254ae Mon Sep 17 00:00:00 2001 From: Duane McKinney Date: Sun, 15 May 2016 03:59:29 -0700 Subject: [PATCH 05/16] Split up recieved log messages before trying to parse. This has 2 benefits. 1st is it will allow us to get the text of the record when the parsing fails. 2nd we no longer have to wait until the stream is closed to receive the last log message. Added another test to send some really mangled XML. --- src/Log2Console/Log/LogMessage.cs | 7 ++ src/Log2Console/Log2Console.csproj | 1 + src/Log2Console/Receiver/ReceiverUtils.cs | 98 ++++++++++++++++------- src/Tests/TestOther/Program.cs | 37 ++++++++- 4 files changed, 115 insertions(+), 28 deletions(-) diff --git a/src/Log2Console/Log/LogMessage.cs b/src/Log2Console/Log/LogMessage.cs index 9e2ed07..3e78202 100644 --- a/src/Log2Console/Log/LogMessage.cs +++ b/src/Log2Console/Log/LogMessage.cs @@ -74,6 +74,11 @@ public class LogMessage /// public uint SourceFileLineNr; + /// + /// The log as it was read. + /// + public string RawLog; + public void CheckNull() { if (string.IsNullOrEmpty(LoggerName)) @@ -171,6 +176,8 @@ public string GetMessageDetails() info = info.Replace("\n", @" \line "); sb.Append(info + @" \line "); } + // Maybe this isn't a good idea, possibly on a new tab. + sb.Append(@"\line \line Raw Log \line " + this.RawLog); sb.Append(@"}"); return sb.ToString(); } diff --git a/src/Log2Console/Log2Console.csproj b/src/Log2Console/Log2Console.csproj index d413251..f3ec4db 100644 --- a/src/Log2Console/Log2Console.csproj +++ b/src/Log2Console/Log2Console.csproj @@ -117,6 +117,7 @@ MainForm.cs + diff --git a/src/Log2Console/Receiver/ReceiverUtils.cs b/src/Log2Console/Receiver/ReceiverUtils.cs index 9b47884..cfbcc7f 100644 --- a/src/Log2Console/Receiver/ReceiverUtils.cs +++ b/src/Log2Console/Receiver/ReceiverUtils.cs @@ -4,6 +4,7 @@ using System.ComponentModel; using System.IO; using System.Text; +using System.Text.RegularExpressions; using System.Xml; namespace Log2Console.Receiver @@ -54,46 +55,89 @@ public static LogMessage ParseLog4JXmlLogEvent(Stream logStream, string defaultL return ParseLog4JXmlLogEvent(reader, defaultLogger); } + /// + /// Try to parse the xml. + /// + /// + /// + /// + private static LogMessage TryParseLog4JXmlLogEvent(string outerXml, string defaultLogger) + { + LogMessage logMessage; + try + { + MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(outerXml)); + logMessage = ParseLog4JXmlLogEvent(ms, defaultLogger); + } + catch(Exception e) + { + logMessage = new LogMessage() + { + LoggerName = nameof(Log2Console.Receiver.ReceiverUtils), + RootLoggerName = nameof(Log2Console.Receiver.ReceiverUtils), + ThreadName = "NA", + Message = "Error parsing log" + Environment.NewLine + outerXml, + TimeStamp = DateTime.Now, + Level = LogLevels.Instance[LogLevel.Warn], + ExceptionString = e.Message + }; + } + logMessage.RawLog = outerXml; + return logMessage; + } + + /// + /// IEnumerable of log events + /// + /// + /// + /// public static IEnumerable ParseLog4JXmlLogEvents(Stream logStream, string defaultLogger) { - // In case of ungraceful disconnect - // logStream is closed and XmlReader throws the exception, - // which we handle in TcpReceiver - using (var reader = XmlReader.Create(logStream, XmlSettings, XmlContext)) + var buffer = new byte[4096]; + int bytesRead = 0; + int startPos = 0; + while((bytesRead = logStream.Read(buffer, startPos, buffer.Length - startPos)) > 0) { - while (!reader.EOF) + string xmlText = Encoding.UTF8.GetString(buffer, 0, bytesRead); + + int leftOversPos = 0; + // This regex will match the start and end tags we are looking for. + var matches = Regex.Matches(xmlText, $"<(/?)\\s*(log4j:event)[^<>]*(/?)>"); + + // Break up the log messages into single log messages before processing. + foreach (Match match in matches) { - if(reader.NodeType == XmlNodeType.Element && reader.Name == "log4j:event") + bool IsBeginElement = String.IsNullOrWhiteSpace(match.Groups[1].Value); + bool IsEmptyElement = match.Value.EndsWith("/>"); + if (IsBeginElement) { - LogMessage logMessage = null; - string logEntry = ""; - try + // Some data before the start tag, this will probably fail. + if (startPos < match.Index) { - logEntry = reader.ReadOuterXml(); - byte[] buffer = Encoding.UTF8.GetBytes(logEntry); - MemoryStream ms = new MemoryStream(buffer); - logMessage = ParseLog4JXmlLogEvent(ms, defaultLogger); + yield return TryParseLog4JXmlLogEvent(xmlText.Substring(startPos, match.Index - startPos), defaultLogger); } - catch(Exception e) + // Empty XML Element, this will always fail, but go ahead and try anyway. + if (IsEmptyElement) { - logMessage = new LogMessage() - { - LoggerName = defaultLogger, - RootLoggerName = defaultLogger, - ThreadName = "NA", - Message = "Error parsing log" + Environment.NewLine + logEntry, - TimeStamp = DateTime.Now, - Level = LogLevels.Instance[LogLevel.Info], - ExceptionString = e.Message - }; + yield return TryParseLog4JXmlLogEvent(xmlText.Substring(match.Index, match.Length), defaultLogger); + leftOversPos = startPos = match.Index + match.Length; + } + else + { + startPos = match.Index; } - yield return logMessage; } - else + else // End element process outer xml { - reader.Read(); + yield return TryParseLog4JXmlLogEvent(xmlText.Substring(startPos, match.Index + match.Length - startPos), defaultLogger); + leftOversPos = startPos = match.Index + match.Length; } } + + var leftOvers = Encoding.UTF8.GetBytes(xmlText.Substring(leftOversPos)); + leftOvers.CopyTo(buffer, 0); + startPos = leftOvers.Length; } } diff --git a/src/Tests/TestOther/Program.cs b/src/Tests/TestOther/Program.cs index 5d68e3d..a10553a 100644 --- a/src/Tests/TestOther/Program.cs +++ b/src/Tests/TestOther/Program.cs @@ -10,7 +10,7 @@ namespace TestOther class Program { const string logBody = -@" +@" {0} @@ -44,6 +44,9 @@ static void Main(string[] args) SendLogMessage(stream, "comments", "" + logBody); + SendLogMessage(stream, "comments in the middle", + logBody.Replace("", "!-- Comments anyone -->")); + SendLogMessage(stream, "Extra spaces in open", logBody.Replace("", "")); @@ -52,6 +55,37 @@ static void Main(string[] args) SendLogMessage(stream, "Done with Test messages"); + SendLogMessage(stream, "Good Luck with this one", +@"123 + < log4j:message abc = ""def"" > Trace Message + < log4j:properties > + < log4j:data name = ""log4japp"" value = ""LINQPad Query Server(13380)"" /> + < log4j:data name = ""log4jmachinename"" value = ""DLM-DEV"" /> + + wft how did I get here? + Debug Message + + + + +321321321321 + + < log4j:message > Hey there's a valid message in the middle of this junk + < log4j:properties > + < log4j:data name = ""log4japp"" value = ""LINQPad Query Server(13380)"" /> + < log4j:data name = ""log4jmachinename"" value = ""DLM-DEV"" /> + + +123123data name = ""log4japp"" value = ""LINQPad Query Server(13380)"" /> + < log4j:data name = ""log4jmachinename"" value = ""DLM-DEV"" /> + + wft how did I get here? + Debug Message + + + + +321123123data name = ""log4j"); //stream.Flush(); stream.Close(); } @@ -62,6 +96,7 @@ static void Main(string[] args) static void SendLogMessage(NetworkStream stream, string logMessage, string logBody = logBody) { + logBody = logBody.Replace("THE_TIME_IS", (DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalMilliseconds.ToString("0")); Console.WriteLine(logMessage); byte[] buffer = Encoding.UTF8.GetBytes(String.Format(logBody, logMessage)); stream.Write(buffer, 0, buffer.Length); From 23f5521d881313631131deea9483604eb77a06f4 Mon Sep 17 00:00:00 2001 From: Duane Mckinney Date: Mon, 12 Dec 2016 23:49:17 -0800 Subject: [PATCH 06/16] Sirilog Tests Added. --- src/Tests/TestSerilog/Person.cs | 26 ++++++ src/Tests/TestSerilog/Program.cs | 91 +++++++++++++++++++ .../TestSerilog/Properties/AssemblyInfo.cs | 36 ++++++++ src/Tests/TestSerilog/TestSerilog.csproj | 90 ++++++++++++++++++ src/Tests/TestSerilog/packages.config | 10 ++ 5 files changed, 253 insertions(+) create mode 100644 src/Tests/TestSerilog/Person.cs create mode 100644 src/Tests/TestSerilog/Program.cs create mode 100644 src/Tests/TestSerilog/Properties/AssemblyInfo.cs create mode 100644 src/Tests/TestSerilog/TestSerilog.csproj create mode 100644 src/Tests/TestSerilog/packages.config diff --git a/src/Tests/TestSerilog/Person.cs b/src/Tests/TestSerilog/Person.cs new file mode 100644 index 0000000..c309636 --- /dev/null +++ b/src/Tests/TestSerilog/Person.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Serilog; + +namespace SerilogTest +{ + class Person + { + Serilog.ILogger Log = Serilog.Log.ForContext(); + + public Person(string name, string ssn, string prop1) + { + Name = name; + Ssn = ssn; + property1 = prop1; + Log.Verbose("ctor {@Person}", this); + } + + public string Name { get; set; } + private string Ssn { get; set; } + private string property1; + } +} diff --git a/src/Tests/TestSerilog/Program.cs b/src/Tests/TestSerilog/Program.cs new file mode 100644 index 0000000..f88e09c --- /dev/null +++ b/src/Tests/TestSerilog/Program.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Net; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using Serilog; +using Serilog.Formatting.Json; +using Serilog.Sinks.Network; + +namespace SerilogTest +{ + class Program + { + static void Main(string[] args) + { + Log.Logger = new LoggerConfiguration() + .MinimumLevel.Verbose() + .WriteTo.RollingFile(new JsonFormatter(), "log-{Date}.txt", retainedFileCountLimit: 2, buffered: true, flushToDiskInterval:TimeSpan.FromSeconds(5)) + .WriteTo.LiterateConsole() + //.WriteTo.Udp(IPAddress.Loopback, 7071) + .WriteTo.UDPSink(IPAddress.Loopback, 7071) + .CreateLogger(); + + Log.Verbose("Verbose"); + Log.Debug("Debug"); + Log.Information("Information"); + Log.Warning("Warning"); + Log.Error("Error"); + Log.Fatal("Fatal"); + + var me = new Person("Duane", "123", "?"); + Log.Information("I just created {@Someone} at {Now}", me, DateTime.Now); + int count = 1; + Log.Information("Create {Count} people", count); + var fruit = new string[] {"Apple", "Pear", "Orange"}; + Log.Information("In my bowl I have {Fruit}", fruit); + + //Console.WriteLine("Enter a simple math statement. Operators supported are (+,-,/,*)"); + //var line = ""; + //while ((line = Console.ReadLine()).ToLower() != "q") + //{ + // Domath(line); + //} + Domath("10/5"); + Domath("8%2"); + Domath("99/0"); + } + + static void Domath(string math) + { + var match = Regex.Match(math, @"(\d+)\s*(\D)\s*(\d+)"); + if (match.Groups.Count == 4) + { + Log.Information("Attempting to process {Operand1}{Operator}{Operand2}", match.Groups[1], match.Groups[2], + match.Groups[3]); + try + { + var operand1 = int.Parse(match.Groups[1].Value); + var operand2 = int.Parse(match.Groups[3].Value); + double answer = 0; + switch (match.Groups[2].Value) + { + case "+": + answer = operand1 + operand2; + break; + case "-": + answer = operand1 - operand2; + break; + case "/": + answer = operand1 / operand2; + break; + case "*": + answer = operand1 * operand2; + break; + default: + throw new InvalidOperationException("Unknown operator"); + break; + } + Log.Information("{Operand1}{Operator}{Operand2}={Answer}", operand1, match.Groups[2], operand2, answer); + } + catch (Exception ex) + { + Log.Error(ex, "Error does not compute"); + } + } + } + } +} diff --git a/src/Tests/TestSerilog/Properties/AssemblyInfo.cs b/src/Tests/TestSerilog/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..7584b85 --- /dev/null +++ b/src/Tests/TestSerilog/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SerilogTest")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SerilogTest")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("b7c629ff-9c17-4373-9695-1e84b3a816ac")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Tests/TestSerilog/TestSerilog.csproj b/src/Tests/TestSerilog/TestSerilog.csproj new file mode 100644 index 0000000..962cd43 --- /dev/null +++ b/src/Tests/TestSerilog/TestSerilog.csproj @@ -0,0 +1,90 @@ + + + + + Debug + AnyCPU + {B7C629FF-9C17-4373-9695-1E84B3A816AC} + Exe + Properties + SerilogTest + SerilogTest + v4.5.2 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\Serilog.2.3.0\lib\net45\Serilog.dll + True + + + ..\packages\Serilog.Sinks.File.3.1.0\lib\net45\Serilog.Sinks.File.dll + True + + + ..\packages\Serilog.Sinks.Literate.2.0.0\lib\net45\Serilog.Sinks.Literate.dll + True + + + ..\packages\Serilog.Sinks.Network.1.0.1.28\lib\net45\Serilog.Sinks.Network.dll + True + + + ..\packages\Serilog.Sinks.PeriodicBatching.2.0.1\lib\net45\Serilog.Sinks.PeriodicBatching.dll + True + + + ..\packages\Serilog.Sinks.RollingFile.3.2.0\lib\net45\Serilog.Sinks.RollingFile.dll + True + + + ..\packages\Serilog.Sinks.Udp.2.1.0\lib\net45\Serilog.Sinks.Udp.dll + True + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Tests/TestSerilog/packages.config b/src/Tests/TestSerilog/packages.config new file mode 100644 index 0000000..9a888d4 --- /dev/null +++ b/src/Tests/TestSerilog/packages.config @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file From e2f0cc74c1990c08659f4f8f2e73a4c3701f9002 Mon Sep 17 00:00:00 2001 From: Duane Mckinney Date: Mon, 12 Dec 2016 23:56:57 -0800 Subject: [PATCH 07/16] Added serilog parser to Udp Listener. --- .gitignore | 20 +++++++ src/Log2Console/Log2Console.csproj | 5 ++ src/Log2Console/Receiver/SerilogParser.cs | 66 +++++++++++++++++++++++ src/Log2Console/Receiver/UdpReceiver.cs | 30 ++++++++++- src/Log2Console/packages.config | 4 ++ src/LogFmwk.sln | 11 +++- src/Tests/TestSerilog/App.config | 6 +++ 7 files changed, 139 insertions(+), 3 deletions(-) create mode 100644 .gitignore create mode 100644 src/Log2Console/Receiver/SerilogParser.cs create mode 100644 src/Log2Console/packages.config create mode 100644 src/Tests/TestSerilog/App.config diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..faaa224 --- /dev/null +++ b/.gitignore @@ -0,0 +1,20 @@ +/src/Tests/TestSerilog/bin +/src/Tests/TestSerilog/obj +/src/Log2Console/bin +/src/.vs/LogFmwk/v14/*.suo +/src/External/WindowsAPICodePack/Core/bin +/src/External/WindowsAPICodePack/Core/obj +/src/External/WindowsAPICodePack/Shell/obj +/src/External/WindowsAPICodePack/Shell/bin +/src/ICSharpCode.TextEditor/obj +/src/Log2Console/obj +/src/RichTextBoxLinks/bin +/src/RichTextBoxLinks/obj +/src/Tests/Test/obj +/src/Tests/Test/bin +/src/Tests/TestNLog/obj +/src/Tests/TestNLog/bin +/src/Tests/TestOther/bin +/src/Tests/TestOther/obj +/src/Log2Console/*.log +/src/packages diff --git a/src/Log2Console/Log2Console.csproj b/src/Log2Console/Log2Console.csproj index d413251..c6ad330 100644 --- a/src/Log2Console/Log2Console.csproj +++ b/src/Log2Console/Log2Console.csproj @@ -81,6 +81,10 @@ False ..\External\log4net.dll + + ..\packages\Newtonsoft.Json.9.0.1\lib\net40\Newtonsoft.Json.dll + True + @@ -117,6 +121,7 @@ MainForm.cs + diff --git a/src/Log2Console/Receiver/SerilogParser.cs b/src/Log2Console/Receiver/SerilogParser.cs new file mode 100644 index 0000000..d677ffd --- /dev/null +++ b/src/Log2Console/Receiver/SerilogParser.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Log2Console.Log; +using Newtonsoft.Json.Linq; + +namespace Log2Console.Receiver +{ + class SerilogParser + { + internal static LogMessage Parse(string logEvent, string defaultLogger) + { + LogMessage message = null; + try + { + message = ParseEvent(logEvent); + } + catch (Exception ex) + { + message = new LogMessage + { + LoggerName = defaultLogger, + RootLoggerName = defaultLogger, + ThreadName = "N/A", + Message = logEvent, + TimeStamp = DateTime.Now, + Level = LogLevels.Instance[LogLevel.Info], + ExceptionString = ex.Message + }; + } + return message; + } + + internal static LogMessage ParseEvent(string logEvent) + { + var logJson = JObject.Parse(logEvent); + LogMessage logMessage = new LogMessage(); + foreach (var child in logJson.Children().OfType()) + { + switch (child.Name) + { + case "timestamp": + logMessage.TimeStamp = DateTime.Parse(child.Value.ToString()); + break; + case "level": + var levels = new[] {"Verbose", "Debug", "Information", "Warning", "Error", "Fatal"}; + logMessage.Level = LogLevels.Instance[Array.IndexOf(levels, child.Value.ToString())]; + break; + case "message": + logMessage.Message = child.Value.ToString(); + break; + case "sourceContext": + logMessage.LoggerName = child.Value.ToString(); + break; + default: + logMessage.Message += $"{Environment.NewLine}{child.Name}:{child.Value}"; + logMessage.Properties[child.Name] = child.Value.ToString(); + break; + } + } + return logMessage; + } + } + +} diff --git a/src/Log2Console/Receiver/UdpReceiver.cs b/src/Log2Console/Receiver/UdpReceiver.cs index 09a8d71..438e655 100644 --- a/src/Log2Console/Receiver/UdpReceiver.cs +++ b/src/Log2Console/Receiver/UdpReceiver.cs @@ -61,6 +61,17 @@ public int BufferSize set { _bufferSize = value; } } + public enum LogFormat + { + Log4J, + Serilog + } + + [Category("Configuration")] + [DisplayName("Log Format")] + public LogFormat LogFormatType { get; set; } = LogFormat.Log4J; + + #region IReceiver Members @@ -75,7 +86,12 @@ public override string SampleClientConfig " " + Environment.NewLine + " " + Environment.NewLine + " " + Environment.NewLine + - ""; + "" + Environment.NewLine + + "Configuration for Serilog:" + Environment.NewLine + + "Log.Logger = new LoggerConfiguration() " + Environment.NewLine + + " .MinimumLevel.Verbose() " + Environment.NewLine + + " .WriteTo.UDPSink(IPAddress.Loopback, 7071)" + Environment.NewLine + + " .CreateLogger(); "; } } @@ -133,10 +149,20 @@ private void Start() if (Notifiable == null) continue; - LogMessage logMsg = ReceiverUtils.ParseLog4JXmlLogEvent(loggingEvent, "UdpLogger"); + LogMessage logMsg = null; + switch (LogFormatType) + { + case LogFormat.Log4J: + logMsg = ReceiverUtils.ParseLog4JXmlLogEvent(loggingEvent, "UdpLogger"); + break; + case LogFormat.Serilog: + logMsg = SerilogParser.Parse(loggingEvent, "UdpLogger"); + break; + } logMsg.RootLoggerName = _remoteEndPoint.Address.ToString().Replace(".", "-"); logMsg.LoggerName = string.Format("{0}_{1}", _remoteEndPoint.Address.ToString().Replace(".", "-"), logMsg.LoggerName); Notifiable.Notify(logMsg); + } catch (Exception ex) { diff --git a/src/Log2Console/packages.config b/src/Log2Console/packages.config new file mode 100644 index 0000000..101fdf5 --- /dev/null +++ b/src/Log2Console/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/LogFmwk.sln b/src/LogFmwk.sln index 8f5ea4c..688cfd3 100644 --- a/src/LogFmwk.sln +++ b/src/LogFmwk.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.25123.0 +VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Log2Console", "Log2Console\Log2Console.csproj", "{EE81C506-55E4-417E-B1D6-09453F89C7CD}" EndProject @@ -25,6 +25,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Tests\Test\Test.csp EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestNLog", "Tests\TestNLog\TestNLog.csproj", "{7C4E8E11-81E3-4297-A4D9-6F6DB90C8EF7}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestSerilog", "Tests\TestSerilog\TestSerilog.csproj", "{B7C629FF-9C17-4373-9695-1E84B3A816AC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution CodeAnalysisDebug|Any CPU = CodeAnalysisDebug|Any CPU @@ -84,6 +86,12 @@ Global {7C4E8E11-81E3-4297-A4D9-6F6DB90C8EF7}.Debug|Any CPU.Build.0 = Debug|Any CPU {7C4E8E11-81E3-4297-A4D9-6F6DB90C8EF7}.Release|Any CPU.ActiveCfg = Release|Any CPU {7C4E8E11-81E3-4297-A4D9-6F6DB90C8EF7}.Release|Any CPU.Build.0 = Release|Any CPU + {B7C629FF-9C17-4373-9695-1E84B3A816AC}.CodeAnalysisDebug|Any CPU.ActiveCfg = Debug|Any CPU + {B7C629FF-9C17-4373-9695-1E84B3A816AC}.CodeAnalysisDebug|Any CPU.Build.0 = Debug|Any CPU + {B7C629FF-9C17-4373-9695-1E84B3A816AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B7C629FF-9C17-4373-9695-1E84B3A816AC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B7C629FF-9C17-4373-9695-1E84B3A816AC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B7C629FF-9C17-4373-9695-1E84B3A816AC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -94,5 +102,6 @@ Global {8B2E0489-1A71-47A6-BB28-2D66C3541BDC} = {8E1F6F4D-8276-4FCB-B2FB-11CDE072BEE2} {29A745D4-5A2F-4170-A0F1-54C77F151892} = {8E1F6F4D-8276-4FCB-B2FB-11CDE072BEE2} {7C4E8E11-81E3-4297-A4D9-6F6DB90C8EF7} = {8E1F6F4D-8276-4FCB-B2FB-11CDE072BEE2} + {B7C629FF-9C17-4373-9695-1E84B3A816AC} = {8E1F6F4D-8276-4FCB-B2FB-11CDE072BEE2} EndGlobalSection EndGlobal diff --git a/src/Tests/TestSerilog/App.config b/src/Tests/TestSerilog/App.config new file mode 100644 index 0000000..d740e88 --- /dev/null +++ b/src/Tests/TestSerilog/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file From 0659858546aff8f631a997f77f9ec4bc9fca49a9 Mon Sep 17 00:00:00 2001 From: Duane McKinney Date: Tue, 13 Dec 2016 00:01:59 -0800 Subject: [PATCH 08/16] Create README.md --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..655271e --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# Log2Console +GitHub clone of SVN repo https://log2console.svn.codeplex.com/svn (cloned by http://svn2github.com/) + +It appeared to me that the project on Codeplex was no longer being maintained, so I forked to project to make some fixes that were bothering me. + +Changes from Codeplex version +-- +* TCP Receiver will attempt to parse multiple messages received over the same socket connection. +* UDP Reciever, added support for Serilog messages in addition to Log4J/NLog. From d0338923c41f8c23185ffb4fc18f267ded54c442 Mon Sep 17 00:00:00 2001 From: Duane McKinney Date: Tue, 13 Dec 2016 00:03:59 -0800 Subject: [PATCH 09/16] Create license.md --- license.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 license.md diff --git a/license.md b/license.md new file mode 100644 index 0000000..93d526f --- /dev/null +++ b/license.md @@ -0,0 +1,15 @@ +Copied from https://log2console.codeplex.com/license + +New BSD License (BSD) +Copyright (c) 2007, Rémy Baudet +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +* Neither the name of Log2Console nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. From 117ad403885215346e2f33250edf369a3df8b9e2 Mon Sep 17 00:00:00 2001 From: Duane McKinney Date: Tue, 13 Dec 2016 06:27:59 -0800 Subject: [PATCH 10/16] Updated Version Info. Fixed Log4J parse bug. --- src/Log2Console/Properties/AssemblyInfo.cs | 4 ++-- src/Log2Console/Receiver/ReceiverUtils.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Log2Console/Properties/AssemblyInfo.cs b/src/Log2Console/Properties/AssemblyInfo.cs index 579161b..dad897d 100644 --- a/src/Log2Console/Properties/AssemblyInfo.cs +++ b/src/Log2Console/Properties/AssemblyInfo.cs @@ -28,5 +28,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("1.6.0.3")] -[assembly: AssemblyFileVersion("1.6.0.3")] +[assembly: AssemblyVersion("1.6.0.4")] +[assembly: AssemblyFileVersion("1.6.0.4")] diff --git a/src/Log2Console/Receiver/ReceiverUtils.cs b/src/Log2Console/Receiver/ReceiverUtils.cs index cfbcc7f..2c44e33 100644 --- a/src/Log2Console/Receiver/ReceiverUtils.cs +++ b/src/Log2Console/Receiver/ReceiverUtils.cs @@ -99,7 +99,7 @@ public static IEnumerable ParseLog4JXmlLogEvents(Stream logStream, s int startPos = 0; while((bytesRead = logStream.Read(buffer, startPos, buffer.Length - startPos)) > 0) { - string xmlText = Encoding.UTF8.GetString(buffer, 0, bytesRead); + string xmlText = Encoding.UTF8.GetString(buffer, 0, bytesRead + startPos); int leftOversPos = 0; // This regex will match the start and end tags we are looking for. From 70287047a8d730fe5698ed14ec76bf8e5ddfd67b Mon Sep 17 00:00:00 2001 From: Duane McKinney Date: Tue, 13 Dec 2016 06:42:44 -0800 Subject: [PATCH 11/16] Fixed NuGet package source. --- src/Tests/TestSerilog/TestSerilog.csproj | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Tests/TestSerilog/TestSerilog.csproj b/src/Tests/TestSerilog/TestSerilog.csproj index 962cd43..89e791c 100644 --- a/src/Tests/TestSerilog/TestSerilog.csproj +++ b/src/Tests/TestSerilog/TestSerilog.csproj @@ -34,31 +34,31 @@ - ..\packages\Serilog.2.3.0\lib\net45\Serilog.dll + ..\..\packages\Serilog.2.3.0\lib\net45\Serilog.dll True - ..\packages\Serilog.Sinks.File.3.1.0\lib\net45\Serilog.Sinks.File.dll + ..\..\packages\Serilog.Sinks.File.3.1.0\lib\net45\Serilog.Sinks.File.dll True - ..\packages\Serilog.Sinks.Literate.2.0.0\lib\net45\Serilog.Sinks.Literate.dll + ..\..\packages\Serilog.Sinks.Literate.2.0.0\lib\net45\Serilog.Sinks.Literate.dll True - ..\packages\Serilog.Sinks.Network.1.0.1.28\lib\net45\Serilog.Sinks.Network.dll + ..\..\packages\Serilog.Sinks.Network.1.0.1.28\lib\net45\Serilog.Sinks.Network.dll True - ..\packages\Serilog.Sinks.PeriodicBatching.2.0.1\lib\net45\Serilog.Sinks.PeriodicBatching.dll + ..\..\packages\Serilog.Sinks.PeriodicBatching.2.0.1\lib\net45\Serilog.Sinks.PeriodicBatching.dll True - ..\packages\Serilog.Sinks.RollingFile.3.2.0\lib\net45\Serilog.Sinks.RollingFile.dll + ..\..\packages\Serilog.Sinks.RollingFile.3.2.0\lib\net45\Serilog.Sinks.RollingFile.dll True - ..\packages\Serilog.Sinks.Udp.2.1.0\lib\net45\Serilog.Sinks.Udp.dll + ..\..\packages\Serilog.Sinks.Udp.2.1.0\lib\net45\Serilog.Sinks.Udp.dll True From 90506bc3fa76523970fe13170167e88e7df73203 Mon Sep 17 00:00:00 2001 From: Duane McKinney Date: Tue, 13 Dec 2016 06:49:31 -0800 Subject: [PATCH 12/16] Made version auto set. --- src/Log2Console/Properties/AssemblyInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Log2Console/Properties/AssemblyInfo.cs b/src/Log2Console/Properties/AssemblyInfo.cs index dad897d..3a8bb36 100644 --- a/src/Log2Console/Properties/AssemblyInfo.cs +++ b/src/Log2Console/Properties/AssemblyInfo.cs @@ -28,5 +28,5 @@ // Build Number // Revision // -[assembly: AssemblyVersion("1.6.0.4")] -[assembly: AssemblyFileVersion("1.6.0.4")] +[assembly: AssemblyVersion("1.6.*")] +//[assembly: AssemblyFileVersion("1.6.*")] From 082eee819f8fb14912a2ea9a24bbf3c16ae9cb79 Mon Sep 17 00:00:00 2001 From: Duane McKinney Date: Tue, 13 Dec 2016 07:39:49 -0800 Subject: [PATCH 13/16] Couldn't modify old setup project, trying to create a new one. Was getting an error about not being able to check it out. --- src/Log2ConsoleSetup/Log2ConsoleSetup.vdproj | 883 +++++++++++++++++++ src/LogFmwk.sln | 11 +- 2 files changed, 888 insertions(+), 6 deletions(-) create mode 100644 src/Log2ConsoleSetup/Log2ConsoleSetup.vdproj diff --git a/src/Log2ConsoleSetup/Log2ConsoleSetup.vdproj b/src/Log2ConsoleSetup/Log2ConsoleSetup.vdproj new file mode 100644 index 0000000..062f61a --- /dev/null +++ b/src/Log2ConsoleSetup/Log2ConsoleSetup.vdproj @@ -0,0 +1,883 @@ +"DeployProject" +{ +"VSVersion" = "3:800" +"ProjectType" = "8:{978C614F-708E-4E1A-B201-565925725DBA}" +"IsWebType" = "8:FALSE" +"ProjectName" = "8:Log2ConsoleSetup" +"LanguageId" = "3:1033" +"CodePage" = "3:1252" +"UILanguageId" = "3:1033" +"SccProjectName" = "8:" +"SccLocalPath" = "8:" +"SccAuxPath" = "8:" +"SccProvider" = "8:" + "Hierarchy" + { + "Entry" + { + "MsmKey" = "8:_9809A07FEC71D18B8AF8747EBBF1CBE3" + "OwnerKey" = "8:_F03687E2A6554E48B667DE4A0AA1552E" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_98FA069438F9D99E4468964C3BECE4C9" + "OwnerKey" = "8:_F03687E2A6554E48B667DE4A0AA1552E" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_A8CE65B1251180814087BE568C395C13" + "OwnerKey" = "8:_F03687E2A6554E48B667DE4A0AA1552E" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_C6619780B23063AE67BFD706FEEE78F0" + "OwnerKey" = "8:_F03687E2A6554E48B667DE4A0AA1552E" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_F03687E2A6554E48B667DE4A0AA1552E" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_9809A07FEC71D18B8AF8747EBBF1CBE3" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_F03687E2A6554E48B667DE4A0AA1552E" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_C6619780B23063AE67BFD706FEEE78F0" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_98FA069438F9D99E4468964C3BECE4C9" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_A8CE65B1251180814087BE568C395C13" + "MsmSig" = "8:_UNDEFINED" + } + } + "Configurations" + { + "Debug" + { + "DisplayName" = "8:Debug" + "IsDebugOnly" = "11:TRUE" + "IsReleaseOnly" = "11:FALSE" + "OutputFilename" = "8:Debug\\Log2ConsoleSetup.msi" + "PackageFilesAs" = "3:2" + "PackageFileSize" = "3:-2147483648" + "CabType" = "3:1" + "Compression" = "3:2" + "SignOutput" = "11:FALSE" + "CertificateFile" = "8:" + "PrivateKeyFile" = "8:" + "TimeStampServer" = "8:" + "InstallerBootstrapper" = "3:2" + } + "Release" + { + "DisplayName" = "8:Release" + "IsDebugOnly" = "11:FALSE" + "IsReleaseOnly" = "11:TRUE" + "OutputFilename" = "8:Release\\Log2ConsoleSetup.msi" + "PackageFilesAs" = "3:2" + "PackageFileSize" = "3:-2147483648" + "CabType" = "3:1" + "Compression" = "3:2" + "SignOutput" = "11:FALSE" + "CertificateFile" = "8:" + "PrivateKeyFile" = "8:" + "TimeStampServer" = "8:" + "InstallerBootstrapper" = "3:2" + } + } + "Deployable" + { + "CustomAction" + { + } + "DefaultFeature" + { + "Name" = "8:DefaultFeature" + "Title" = "8:" + "Description" = "8:" + } + "ExternalPersistence" + { + "LaunchCondition" + { + "{A06ECF26-33A3-4562-8140-9B0E340D4F24}:_45CF2705D6044F4B90E934060E7CEFEB" + { + "Name" = "8:.NET Framework" + "Message" = "8:[VSDNETMSG]" + "FrameworkVersion" = "8:.NETFramework,Version=v4.5" + "AllowLaterVersions" = "11:FALSE" + "InstallUrl" = "8:http://go.microsoft.com/fwlink/?LinkId=395269" + } + } + } + "File" + { + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_9809A07FEC71D18B8AF8747EBBF1CBE3" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:ICSharpCode.TextEditor, Version=3.0.0.3437, Culture=neutral, PublicKeyToken=4d61825e8dd49f1a, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_9809A07FEC71D18B8AF8747EBBF1CBE3" + { + "Name" = "8:ICSharpCode.TextEditor.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:ICSharpCode.TextEditor.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_B42E984976D74777AEFB598EDD0F212D" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_98FA069438F9D99E4468964C3BECE4C9" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_98FA069438F9D99E4468964C3BECE4C9" + { + "Name" = "8:Newtonsoft.Json.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:Newtonsoft.Json.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_B42E984976D74777AEFB598EDD0F212D" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_A8CE65B1251180814087BE568C395C13" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_A8CE65B1251180814087BE568C395C13" + { + "Name" = "8:log4net.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:log4net.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_B42E984976D74777AEFB598EDD0F212D" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_C6619780B23063AE67BFD706FEEE78F0" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:RichTextBoxLinks, Version=1.0.6191.12180, Culture=neutral, processorArchitecture=MSIL" + "ScatterAssemblies" + { + "_C6619780B23063AE67BFD706FEEE78F0" + { + "Name" = "8:RichTextBoxLinks.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:RichTextBoxLinks.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_B42E984976D74777AEFB598EDD0F212D" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + } + "FileType" + { + } + "Folder" + { + "{3C67513D-01DD-4637-8A68-80971EB9504F}:_B42E984976D74777AEFB598EDD0F212D" + { + "DefaultLocation" = "8:[ProgramFilesFolder][Manufacturer]\\[ProductName]" + "Name" = "8:#1925" + "AlwaysCreate" = "11:FALSE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:TARGETDIR" + "Folders" + { + } + } + "{1525181F-901A-416C-8A58-119130FE478E}:_BFCE4E478F5E4691AF1B1CCD67159EF2" + { + "Name" = "8:#1919" + "AlwaysCreate" = "11:FALSE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:ProgramMenuFolder" + "Folders" + { + } + } + "{1525181F-901A-416C-8A58-119130FE478E}:_DF7015A4B2514F44B3996DD53C6047B9" + { + "Name" = "8:#1916" + "AlwaysCreate" = "11:FALSE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:DesktopFolder" + "Folders" + { + } + } + } + "LaunchCondition" + { + } + "Locator" + { + } + "MsiBootstrapper" + { + "LangId" = "3:1033" + "RequiresElevation" = "11:FALSE" + } + "Product" + { + "Name" = "8:Microsoft Visual Studio" + "ProductName" = "8:Log2Console" + "ProductCode" = "8:{8A1E4F39-714F-42D9-A73F-257619ED4F18}" + "PackageCode" = "8:{8B5F0367-611F-412E-A6C9-45C2B8B68DBE}" + "UpgradeCode" = "8:{2A137B8E-9AB2-43FB-9EBC-628E989DCBFD}" + "AspNetVersion" = "8:4.0.30319.0" + "RestartWWWService" = "11:FALSE" + "RemovePreviousVersions" = "11:FALSE" + "DetectNewerInstalledVersion" = "11:TRUE" + "InstallAllUsers" = "11:FALSE" + "ProductVersion" = "8:1.6" + "Manufacturer" = "8:Log2Console" + "ARPHELPTELEPHONE" = "8:" + "ARPHELPLINK" = "8:https://github.com/DewJunkie/Log2Console" + "Title" = "8:Log2Console Setup" + "Subject" = "8:" + "ARPCONTACT" = "8:Log2Console" + "Keywords" = "8:" + "ARPCOMMENTS" = "8:Log2Console" + "ARPURLINFOABOUT" = "8:https://github.com/DewJunkie/Log2Console" + "ARPPRODUCTICON" = "8:" + "ARPIconIndex" = "3:0" + "SearchPath" = "8:" + "UseSystemSearchPath" = "11:TRUE" + "TargetPlatform" = "3:0" + "PreBuildEvent" = "8:" + "PostBuildEvent" = "8:" + "RunPostBuildEvent" = "3:0" + } + "Registry" + { + "HKLM" + { + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_0E8631B727B14C938FC20272FD2C1996" + { + "Name" = "8:Software" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_A212D0B75EC948BFBC36FF026A417BEB" + { + "Name" = "8:[Manufacturer]" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + } + "Values" + { + } + } + } + "Values" + { + } + } + } + } + "HKCU" + { + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_20ABD0068A3749F3B25276F273BFF8F2" + { + "Name" = "8:Software" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_01B74F58AB3C464182E824D44AF7F8FF" + { + "Name" = "8:[Manufacturer]" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + } + "Values" + { + } + } + } + "Values" + { + } + } + } + } + "HKCR" + { + "Keys" + { + } + } + "HKU" + { + "Keys" + { + } + } + "HKPU" + { + "Keys" + { + } + } + } + "Sequences" + { + } + "Shortcut" + { + "{970C0BB2-C7D0-45D7-ABFA-7EC378858BC0}:_12F1D3298FF34D91BA2D61E8D48BE423" + { + "Name" = "8:Log2Console" + "Arguments" = "8:" + "Description" = "8:" + "ShowCmd" = "3:1" + "IconIndex" = "3:0" + "Transitive" = "11:FALSE" + "Target" = "8:_F03687E2A6554E48B667DE4A0AA1552E" + "Folder" = "8:_BFCE4E478F5E4691AF1B1CCD67159EF2" + "WorkingFolder" = "8:_B42E984976D74777AEFB598EDD0F212D" + "Icon" = "8:" + "Feature" = "8:" + } + } + "UserInterface" + { + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_1E34D53A1EF54E7B8D6C639A1D19BF86" + { + "Name" = "8:#1902" + "Sequence" = "3:2" + "Attributes" = "3:3" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_ADEAFE2759544622B9AD22C2127946A1" + { + "Sequence" = "3:100" + "DisplayName" = "8:Finished" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminFinishedDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{2479F3F5-0309-486D-8047-8187E2CE5BA0}:_2FAF8782F9574830903662BE0B01E67E" + { + "UseDynamicProperties" = "11:FALSE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdBasicDialogs.wim" + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_446F1BC0838C4B5A9A1BE2D07227C3E5" + { + "Name" = "8:#1902" + "Sequence" = "3:1" + "Attributes" = "3:3" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_F42D220F17DE4CEFBF92042F2FDFC743" + { + "Sequence" = "3:100" + "DisplayName" = "8:Finished" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdFinishedDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "UpdateText" + { + "Name" = "8:UpdateText" + "DisplayName" = "8:#1058" + "Description" = "8:#1158" + "Type" = "3:15" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1258" + "DefaultValue" = "8:#1258" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_5029EDE4D02240F188D5A5B1B9AE082F" + { + "Name" = "8:#1901" + "Sequence" = "3:2" + "Attributes" = "3:2" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_38906AB5187740818A539CA3F98DB1AB" + { + "Sequence" = "3:100" + "DisplayName" = "8:Progress" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminProgressDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "ShowProgress" + { + "Name" = "8:ShowProgress" + "DisplayName" = "8:#1009" + "Description" = "8:#1109" + "Type" = "3:5" + "ContextData" = "8:1;True=1;False=0" + "Attributes" = "3:0" + "Setting" = "3:0" + "Value" = "3:1" + "DefaultValue" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_A45AF2A021864DE6A8557B18B02F9CFF" + { + "Name" = "8:#1900" + "Sequence" = "3:1" + "Attributes" = "3:1" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_184B7027A0D84CE9B31CCDDBCE6A0CA5" + { + "Sequence" = "3:200" + "DisplayName" = "8:Installation Folder" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdFolderDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "InstallAllUsersVisible" + { + "Name" = "8:InstallAllUsersVisible" + "DisplayName" = "8:#1059" + "Description" = "8:#1159" + "Type" = "3:5" + "ContextData" = "8:1;True=1;False=0" + "Attributes" = "3:0" + "Setting" = "3:0" + "Value" = "3:1" + "DefaultValue" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_346724EC792442C1BFEAD10B6D64E696" + { + "Sequence" = "3:100" + "DisplayName" = "8:Welcome" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdWelcomeDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "CopyrightWarning" + { + "Name" = "8:CopyrightWarning" + "DisplayName" = "8:#1002" + "Description" = "8:#1102" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1202" + "DefaultValue" = "8:#1202" + "UsePlugInResources" = "11:TRUE" + } + "Welcome" + { + "Name" = "8:Welcome" + "DisplayName" = "8:#1003" + "Description" = "8:#1103" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1203" + "DefaultValue" = "8:#1203" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_FB5E135524284BFAAE7BDAD8ADFAACA7" + { + "Sequence" = "3:300" + "DisplayName" = "8:Confirm Installation" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdConfirmDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{2479F3F5-0309-486D-8047-8187E2CE5BA0}:_C5A839FB5E874BF688F350B8677EBF40" + { + "UseDynamicProperties" = "11:FALSE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdUserInterface.wim" + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_CC5EBDA48B2B400984EC839055878AF6" + { + "Name" = "8:#1901" + "Sequence" = "3:1" + "Attributes" = "3:2" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_ED6039B350CB45EA875E8DA4B6F20976" + { + "Sequence" = "3:100" + "DisplayName" = "8:Progress" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdProgressDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "ShowProgress" + { + "Name" = "8:ShowProgress" + "DisplayName" = "8:#1009" + "Description" = "8:#1109" + "Type" = "3:5" + "ContextData" = "8:1;True=1;False=0" + "Attributes" = "3:0" + "Setting" = "3:0" + "Value" = "3:1" + "DefaultValue" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_D7B771E62D1B4114BAC8A3CB44F21118" + { + "Name" = "8:#1900" + "Sequence" = "3:2" + "Attributes" = "3:1" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_5EFED9C576EB418EA0951775723515F7" + { + "Sequence" = "3:300" + "DisplayName" = "8:Confirm Installation" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminConfirmDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_67F54800B57C40159CB295922CB668E4" + { + "Sequence" = "3:100" + "DisplayName" = "8:Welcome" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminWelcomeDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "CopyrightWarning" + { + "Name" = "8:CopyrightWarning" + "DisplayName" = "8:#1002" + "Description" = "8:#1102" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1202" + "DefaultValue" = "8:#1202" + "UsePlugInResources" = "11:TRUE" + } + "Welcome" + { + "Name" = "8:Welcome" + "DisplayName" = "8:#1003" + "Description" = "8:#1103" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1203" + "DefaultValue" = "8:#1203" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_B533921AADB44C028429FF5CCAEB7653" + { + "Sequence" = "3:200" + "DisplayName" = "8:Installation Folder" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminFolderDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + } + "MergeModule" + { + } + "ProjectOutput" + { + "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_F03687E2A6554E48B667DE4A0AA1552E" + { + "SourcePath" = "8:..\\Log2Console\\obj\\Release\\Log2Console.exe" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_B42E984976D74777AEFB598EDD0F212D" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + "ProjectOutputGroupRegister" = "3:1" + "OutputConfiguration" = "8:" + "OutputGroupCanonicalName" = "8:Built" + "OutputProjectGuid" = "8:{EE81C506-55E4-417E-B1D6-09453F89C7CD}" + "ShowKeyOutput" = "11:TRUE" + "ExcludeFilters" + { + } + } + } + } +} diff --git a/src/LogFmwk.sln b/src/LogFmwk.sln index 688cfd3..709bfd0 100644 --- a/src/LogFmwk.sln +++ b/src/LogFmwk.sln @@ -5,8 +5,6 @@ VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Log2Console", "Log2Console\Log2Console.csproj", "{EE81C506-55E4-417E-B1D6-09453F89C7CD}" EndProject -Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "L2C_Setup", "L2C_Setup\L2C_Setup.vdproj", "{19438485-B918-42F2-8DC7-F352D24AC55E}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WindowsAPICodePack", "WindowsAPICodePack", "{3E29A216-D8DA-4858-9EB0-D9C0C565C50B}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core", "External\WindowsAPICodePack\Core\Core.csproj", "{2E1FB0DF-F9BB-4909-9F32-2D9D022A8E57}" @@ -27,6 +25,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestNLog", "Tests\TestNLog\ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestSerilog", "Tests\TestSerilog\TestSerilog.csproj", "{B7C629FF-9C17-4373-9695-1E84B3A816AC}" EndProject +Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "Log2ConsoleSetup", "Log2ConsoleSetup\Log2ConsoleSetup.vdproj", "{ECF76B04-A82D-4968-93F0-0E00C1908898}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution CodeAnalysisDebug|Any CPU = CodeAnalysisDebug|Any CPU @@ -40,10 +40,6 @@ Global {EE81C506-55E4-417E-B1D6-09453F89C7CD}.Debug|Any CPU.Build.0 = Debug|Any CPU {EE81C506-55E4-417E-B1D6-09453F89C7CD}.Release|Any CPU.ActiveCfg = Release|Any CPU {EE81C506-55E4-417E-B1D6-09453F89C7CD}.Release|Any CPU.Build.0 = Release|Any CPU - {19438485-B918-42F2-8DC7-F352D24AC55E}.CodeAnalysisDebug|Any CPU.ActiveCfg = Debug - {19438485-B918-42F2-8DC7-F352D24AC55E}.CodeAnalysisDebug|Any CPU.Build.0 = Debug - {19438485-B918-42F2-8DC7-F352D24AC55E}.Debug|Any CPU.ActiveCfg = Debug - {19438485-B918-42F2-8DC7-F352D24AC55E}.Release|Any CPU.ActiveCfg = Release {2E1FB0DF-F9BB-4909-9F32-2D9D022A8E57}.CodeAnalysisDebug|Any CPU.ActiveCfg = Debug|Any CPU {2E1FB0DF-F9BB-4909-9F32-2D9D022A8E57}.CodeAnalysisDebug|Any CPU.Build.0 = Debug|Any CPU {2E1FB0DF-F9BB-4909-9F32-2D9D022A8E57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU @@ -92,6 +88,9 @@ Global {B7C629FF-9C17-4373-9695-1E84B3A816AC}.Debug|Any CPU.Build.0 = Debug|Any CPU {B7C629FF-9C17-4373-9695-1E84B3A816AC}.Release|Any CPU.ActiveCfg = Release|Any CPU {B7C629FF-9C17-4373-9695-1E84B3A816AC}.Release|Any CPU.Build.0 = Release|Any CPU + {ECF76B04-A82D-4968-93F0-0E00C1908898}.CodeAnalysisDebug|Any CPU.ActiveCfg = Debug + {ECF76B04-A82D-4968-93F0-0E00C1908898}.Debug|Any CPU.ActiveCfg = Debug + {ECF76B04-A82D-4968-93F0-0E00C1908898}.Release|Any CPU.ActiveCfg = Release EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 238d5e998b9c0adae25a043d1acc77cd957602d0 Mon Sep 17 00:00:00 2001 From: Duane McKinney Date: Tue, 13 Dec 2016 08:32:56 -0800 Subject: [PATCH 14/16] Added some additional serilog tests. Made a cmd file to zip install to a single exe. --- src/Log2ConsoleSetup/Log2ConsoleSetup.vdproj | 50 +++++++++++++++----- src/Log2ConsoleSetup/MakeRelease.cmd | 18 +++++++ src/Log2ConsoleSetup/config.txt | 3 ++ src/Tests/Test/Test.csproj | 2 +- src/Tests/TestNLog/TestNLog.csproj | 2 +- src/Tests/TestOther/TestOther.csproj | 2 +- src/Tests/TestSerilog/Address.cs | 14 ++++++ src/Tests/TestSerilog/Person.cs | 2 + src/Tests/TestSerilog/Program.cs | 22 ++++++++- src/Tests/TestSerilog/TestSerilog.csproj | 3 +- 10 files changed, 100 insertions(+), 18 deletions(-) create mode 100644 src/Log2ConsoleSetup/MakeRelease.cmd create mode 100644 src/Log2ConsoleSetup/config.txt create mode 100644 src/Tests/TestSerilog/Address.cs diff --git a/src/Log2ConsoleSetup/Log2ConsoleSetup.vdproj b/src/Log2ConsoleSetup/Log2ConsoleSetup.vdproj index 062f61a..b450063 100644 --- a/src/Log2ConsoleSetup/Log2ConsoleSetup.vdproj +++ b/src/Log2ConsoleSetup/Log2ConsoleSetup.vdproj @@ -46,31 +46,31 @@ "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_9809A07FEC71D18B8AF8747EBBF1CBE3" + "OwnerKey" = "8:_F03687E2A6554E48B667DE4A0AA1552E" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_F03687E2A6554E48B667DE4A0AA1552E" + "OwnerKey" = "8:_C6619780B23063AE67BFD706FEEE78F0" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_C6619780B23063AE67BFD706FEEE78F0" + "OwnerKey" = "8:_98FA069438F9D99E4468964C3BECE4C9" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_98FA069438F9D99E4468964C3BECE4C9" + "OwnerKey" = "8:_A8CE65B1251180814087BE568C395C13" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_A8CE65B1251180814087BE568C395C13" + "OwnerKey" = "8:_9809A07FEC71D18B8AF8747EBBF1CBE3" "MsmSig" = "8:_UNDEFINED" } } @@ -82,7 +82,7 @@ "IsDebugOnly" = "11:TRUE" "IsReleaseOnly" = "11:FALSE" "OutputFilename" = "8:Debug\\Log2ConsoleSetup.msi" - "PackageFilesAs" = "3:2" + "PackageFilesAs" = "3:1" "PackageFileSize" = "3:-2147483648" "CabType" = "3:1" "Compression" = "3:2" @@ -91,6 +91,14 @@ "PrivateKeyFile" = "8:" "TimeStampServer" = "8:" "InstallerBootstrapper" = "3:2" + "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}" + { + "Enabled" = "11:TRUE" + "PromptEnabled" = "11:TRUE" + "PrerequisitesLocation" = "2:1" + "Url" = "8:" + "ComponentsUrl" = "8:" + } } "Release" { @@ -101,12 +109,28 @@ "PackageFilesAs" = "3:2" "PackageFileSize" = "3:-2147483648" "CabType" = "3:1" - "Compression" = "3:2" + "Compression" = "3:1" "SignOutput" = "11:FALSE" "CertificateFile" = "8:" "PrivateKeyFile" = "8:" "TimeStampServer" = "8:" "InstallerBootstrapper" = "3:2" + "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}" + { + "Enabled" = "11:TRUE" + "PromptEnabled" = "11:TRUE" + "PrerequisitesLocation" = "2:1" + "Url" = "8:" + "ComponentsUrl" = "8:" + "Items" + { + "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:.NETFramework,Version=v4.5" + { + "Name" = "8:Microsoft .NET Framework 4.5 (x86 and x64)" + "ProductCode" = "8:.NETFramework,Version=v4.5" + } + } + } } } "Deployable" @@ -316,15 +340,15 @@ { "Name" = "8:Microsoft Visual Studio" "ProductName" = "8:Log2Console" - "ProductCode" = "8:{8A1E4F39-714F-42D9-A73F-257619ED4F18}" - "PackageCode" = "8:{8B5F0367-611F-412E-A6C9-45C2B8B68DBE}" + "ProductCode" = "8:{50998C1A-137E-4F8F-A6A0-62635C1F959D}" + "PackageCode" = "8:{9F01028A-B913-452A-9EDD-BDB43EDA495E}" "UpgradeCode" = "8:{2A137B8E-9AB2-43FB-9EBC-628E989DCBFD}" "AspNetVersion" = "8:4.0.30319.0" "RestartWWWService" = "11:FALSE" "RemovePreviousVersions" = "11:FALSE" "DetectNewerInstalledVersion" = "11:TRUE" "InstallAllUsers" = "11:FALSE" - "ProductVersion" = "8:1.6" + "ProductVersion" = "8:1.6.2" "Manufacturer" = "8:Log2Console" "ARPHELPTELEPHONE" = "8:" "ARPHELPLINK" = "8:https://github.com/DewJunkie/Log2Console" @@ -332,7 +356,7 @@ "Subject" = "8:" "ARPCONTACT" = "8:Log2Console" "Keywords" = "8:" - "ARPCOMMENTS" = "8:Log2Console" + "ARPCOMMENTS" = "8:Log2Console 1.6 RC1" "ARPURLINFOABOUT" = "8:https://github.com/DewJunkie/Log2Console" "ARPPRODUCTICON" = "8:" "ARPIconIndex" = "3:0" @@ -443,12 +467,12 @@ "Arguments" = "8:" "Description" = "8:" "ShowCmd" = "3:1" - "IconIndex" = "3:0" + "IconIndex" = "3:32512" "Transitive" = "11:FALSE" "Target" = "8:_F03687E2A6554E48B667DE4A0AA1552E" "Folder" = "8:_BFCE4E478F5E4691AF1B1CCD67159EF2" "WorkingFolder" = "8:_B42E984976D74777AEFB598EDD0F212D" - "Icon" = "8:" + "Icon" = "8:_F03687E2A6554E48B667DE4A0AA1552E" "Feature" = "8:" } } diff --git a/src/Log2ConsoleSetup/MakeRelease.cmd b/src/Log2ConsoleSetup/MakeRelease.cmd new file mode 100644 index 0000000..b17089f --- /dev/null +++ b/src/Log2ConsoleSetup/MakeRelease.cmd @@ -0,0 +1,18 @@ +set version=1.6.2 + + +pushd Release + +rem create archives +rem "c:\Program Files\7-Zip\7z" a -tzip -mx=9 DvrServerSetup-%version%.zip * +"c:\Program Files\7-Zip\7z" a -t7z -mx=9 Log2Console-%version%.7z * +copy /b /y "C:\Program Files\7-Zip\7zs.sfx" + ..\config.txt + Log2Console-%version%.7z Log2Console-%version%.exe + +rem Move to destination +rem move DvrServerSetup-%version%.zip ..\ +move Log2Console-%version%.7z ..\ +move Log2Console-%version%.exe ..\ +popd + + +pause diff --git a/src/Log2ConsoleSetup/config.txt b/src/Log2ConsoleSetup/config.txt new file mode 100644 index 0000000..bf56f79 --- /dev/null +++ b/src/Log2ConsoleSetup/config.txt @@ -0,0 +1,3 @@ +;!@Install@!UTF-8! +Title="Log2Console Setup" +;!@InstallEnd@! diff --git a/src/Tests/Test/Test.csproj b/src/Tests/Test/Test.csproj index fe20990..0f2f087 100644 --- a/src/Tests/Test/Test.csproj +++ b/src/Tests/Test/Test.csproj @@ -51,7 +51,7 @@ pdbonly true - bin\Release\ + ..\bin\Release\ TRACE prompt 4 diff --git a/src/Tests/TestNLog/TestNLog.csproj b/src/Tests/TestNLog/TestNLog.csproj index 3278da4..0d2ec30 100644 --- a/src/Tests/TestNLog/TestNLog.csproj +++ b/src/Tests/TestNLog/TestNLog.csproj @@ -31,7 +31,7 @@ true - bin\Release\ + ..\bin\Release\ TRACE true pdbonly diff --git a/src/Tests/TestOther/TestOther.csproj b/src/Tests/TestOther/TestOther.csproj index 29f55e2..95dbc42 100644 --- a/src/Tests/TestOther/TestOther.csproj +++ b/src/Tests/TestOther/TestOther.csproj @@ -26,7 +26,7 @@ AnyCPU pdbonly true - bin\Release\ + ..\bin\Release\ TRACE prompt 4 diff --git a/src/Tests/TestSerilog/Address.cs b/src/Tests/TestSerilog/Address.cs new file mode 100644 index 0000000..5885bdb --- /dev/null +++ b/src/Tests/TestSerilog/Address.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SerilogTest +{ + class Address + { + public string Line1 { get; set; } + public string City { get; set; } + } +} diff --git a/src/Tests/TestSerilog/Person.cs b/src/Tests/TestSerilog/Person.cs index c309636..2900658 100644 --- a/src/Tests/TestSerilog/Person.cs +++ b/src/Tests/TestSerilog/Person.cs @@ -22,5 +22,7 @@ public Person(string name, string ssn, string prop1) public string Name { get; set; } private string Ssn { get; set; } private string property1; + + public List
Addresses { get; set; } } } diff --git a/src/Tests/TestSerilog/Program.cs b/src/Tests/TestSerilog/Program.cs index f88e09c..cdbcc3f 100644 --- a/src/Tests/TestSerilog/Program.cs +++ b/src/Tests/TestSerilog/Program.cs @@ -21,7 +21,7 @@ static void Main(string[] args) .WriteTo.RollingFile(new JsonFormatter(), "log-{Date}.txt", retainedFileCountLimit: 2, buffered: true, flushToDiskInterval:TimeSpan.FromSeconds(5)) .WriteTo.LiterateConsole() //.WriteTo.Udp(IPAddress.Loopback, 7071) - .WriteTo.UDPSink(IPAddress.Loopback, 7071) + .WriteTo.UDPSink(IPAddress.Loopback, 1337) .CreateLogger(); Log.Verbose("Verbose"); @@ -47,6 +47,26 @@ static void Main(string[] args) Domath("10/5"); Domath("8%2"); Domath("99/0"); + + var person = new Person("Person1", "123", "private info"); + person.Addresses = new List
(); + person.Addresses.Add(new Address() + { + Line1 = "Address1" + }); + person.Addresses.Add(new Address() + { + Line1 = "Address2" + }); + Log.Information("This person has multiple addresses {@Person}, 1st one is {@Address}", person, person.Addresses.FirstOrDefault()); + Log.Information("This person has multiple addresses {Person}, 1st one is {Address}", person, person.Addresses.FirstOrDefault()); + + Log.Information("This bool is {True}", true); + Log.Information("The number is {One}", 1); + Log.Information("The time is {Now}", DateTime.Now); + Log.Information("Googles uri is {Uri}", new Uri("http://google.com/")); + + Log.Information("Don't try to serialize this {$Person}", person); } static void Domath(string math) diff --git a/src/Tests/TestSerilog/TestSerilog.csproj b/src/Tests/TestSerilog/TestSerilog.csproj index 89e791c..52fc05e 100644 --- a/src/Tests/TestSerilog/TestSerilog.csproj +++ b/src/Tests/TestSerilog/TestSerilog.csproj @@ -27,7 +27,7 @@ AnyCPU pdbonly true - bin\Release\ + ..\bin\Release\ TRACE prompt 4 @@ -71,6 +71,7 @@ + From c3d456bbc69497eced998ba3ff336a819b0b278b Mon Sep 17 00:00:00 2001 From: Duane McKinney Date: Sat, 17 Dec 2016 14:58:39 -0800 Subject: [PATCH 15/16] Added option to condense Root Logger Name to TCP receiver. Added context to serilog test. --- src/Log2Console/Receiver/SerilogParser.cs | 4 ++ src/Log2Console/Receiver/UdpReceiver.cs | 24 ++++++++++- src/Log2ConsoleSetup/Log2ConsoleSetup.vdproj | 42 +++++++------------- src/Log2ConsoleSetup/MakeRelease.cmd | 2 +- src/Tests/Test/Test.csproj | 2 +- src/Tests/TestNLog/TestNLog.csproj | 2 +- src/Tests/TestOther/TestOther.csproj | 2 +- src/Tests/TestSerilog/Program.cs | 36 +++++++++-------- src/Tests/TestSerilog/TestSerilog.csproj | 2 +- 9 files changed, 66 insertions(+), 50 deletions(-) diff --git a/src/Log2Console/Receiver/SerilogParser.cs b/src/Log2Console/Receiver/SerilogParser.cs index d677ffd..3ff9637 100644 --- a/src/Log2Console/Receiver/SerilogParser.cs +++ b/src/Log2Console/Receiver/SerilogParser.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Text; using Log2Console.Log; @@ -38,6 +39,9 @@ internal static LogMessage ParseEvent(string logEvent) LogMessage logMessage = new LogMessage(); foreach (var child in logJson.Children().OfType()) { +#if DEBUG + Debug.WriteLine($"{child.Name}={child.Value}"); +#endif switch (child.Name) { case "timestamp": diff --git a/src/Log2Console/Receiver/UdpReceiver.cs b/src/Log2Console/Receiver/UdpReceiver.cs index 438e655..70cdb38 100644 --- a/src/Log2Console/Receiver/UdpReceiver.cs +++ b/src/Log2Console/Receiver/UdpReceiver.cs @@ -70,6 +70,10 @@ public enum LogFormat [Category("Configuration")] [DisplayName("Log Format")] public LogFormat LogFormatType { get; set; } = LogFormat.Log4J; + + [Category("Configuration")] + [DisplayName("Condense Camel Case")] + public bool CondenseCamelCase { get; set; } = true; @@ -159,8 +163,24 @@ private void Start() logMsg = SerilogParser.Parse(loggingEvent, "UdpLogger"); break; } - logMsg.RootLoggerName = _remoteEndPoint.Address.ToString().Replace(".", "-"); - logMsg.LoggerName = string.Format("{0}_{1}", _remoteEndPoint.Address.ToString().Replace(".", "-"), logMsg.LoggerName); + //logMsg.RootLoggerName = _remoteEndPoint.Address.ToString().Replace(".", "-"); + //logMsg.LoggerName = string.Format("{0}_{1}", _remoteEndPoint.Address.ToString().Replace(".", "-"), logMsg.LoggerName); + logMsg.RootLoggerName = logMsg.LoggerName; + if (CondenseCamelCase) + { + var newName = ""; + var stopAt = logMsg.LoggerName.LastIndexOf('.'); + for (int i = 0; i < stopAt; i++) + { + if (Char.IsUpper(logMsg.LoggerName[i]) || logMsg.LoggerName[i] == '.') + { + newName += logMsg.LoggerName[i]; + } + } + newName += logMsg.LoggerName.Substring(stopAt); + logMsg.RootLoggerName = newName; + } + logMsg.LoggerName = string.Format(":{1}.{0}", logMsg.LoggerName, _port); Notifiable.Notify(logMsg); } diff --git a/src/Log2ConsoleSetup/Log2ConsoleSetup.vdproj b/src/Log2ConsoleSetup/Log2ConsoleSetup.vdproj index b450063..72298f1 100644 --- a/src/Log2ConsoleSetup/Log2ConsoleSetup.vdproj +++ b/src/Log2ConsoleSetup/Log2ConsoleSetup.vdproj @@ -52,25 +52,25 @@ "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_C6619780B23063AE67BFD706FEEE78F0" + "OwnerKey" = "8:_9809A07FEC71D18B8AF8747EBBF1CBE3" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_98FA069438F9D99E4468964C3BECE4C9" + "OwnerKey" = "8:_A8CE65B1251180814087BE568C395C13" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_A8CE65B1251180814087BE568C395C13" + "OwnerKey" = "8:_98FA069438F9D99E4468964C3BECE4C9" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_9809A07FEC71D18B8AF8747EBBF1CBE3" + "OwnerKey" = "8:_C6619780B23063AE67BFD706FEEE78F0" "MsmSig" = "8:_UNDEFINED" } } @@ -98,6 +98,14 @@ "PrerequisitesLocation" = "2:1" "Url" = "8:" "ComponentsUrl" = "8:" + "Items" + { + "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:.NETFramework,Version=v4.5" + { + "Name" = "8:Microsoft .NET Framework 4.5 (x86 and x64)" + "ProductCode" = "8:.NETFramework,Version=v4.5" + } + } } } "Release" @@ -167,11 +175,6 @@ "AssemblyAsmDisplayName" = "8:ICSharpCode.TextEditor, Version=3.0.0.3437, Culture=neutral, PublicKeyToken=4d61825e8dd49f1a, processorArchitecture=MSIL" "ScatterAssemblies" { - "_9809A07FEC71D18B8AF8747EBBF1CBE3" - { - "Name" = "8:ICSharpCode.TextEditor.dll" - "Attributes" = "3:512" - } } "SourcePath" = "8:ICSharpCode.TextEditor.dll" "TargetName" = "8:" @@ -198,11 +201,6 @@ "AssemblyAsmDisplayName" = "8:Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL" "ScatterAssemblies" { - "_98FA069438F9D99E4468964C3BECE4C9" - { - "Name" = "8:Newtonsoft.Json.dll" - "Attributes" = "3:512" - } } "SourcePath" = "8:Newtonsoft.Json.dll" "TargetName" = "8:" @@ -229,11 +227,6 @@ "AssemblyAsmDisplayName" = "8:log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL" "ScatterAssemblies" { - "_A8CE65B1251180814087BE568C395C13" - { - "Name" = "8:log4net.dll" - "Attributes" = "3:512" - } } "SourcePath" = "8:log4net.dll" "TargetName" = "8:" @@ -260,11 +253,6 @@ "AssemblyAsmDisplayName" = "8:RichTextBoxLinks, Version=1.0.6191.12180, Culture=neutral, processorArchitecture=MSIL" "ScatterAssemblies" { - "_C6619780B23063AE67BFD706FEEE78F0" - { - "Name" = "8:RichTextBoxLinks.dll" - "Attributes" = "3:512" - } } "SourcePath" = "8:RichTextBoxLinks.dll" "TargetName" = "8:" @@ -340,15 +328,15 @@ { "Name" = "8:Microsoft Visual Studio" "ProductName" = "8:Log2Console" - "ProductCode" = "8:{50998C1A-137E-4F8F-A6A0-62635C1F959D}" - "PackageCode" = "8:{9F01028A-B913-452A-9EDD-BDB43EDA495E}" + "ProductCode" = "8:{DABF7879-B755-475A-A72C-3C4A2C17D8DE}" + "PackageCode" = "8:{DEAEF41A-73B0-420A-B511-0868B9C0B464}" "UpgradeCode" = "8:{2A137B8E-9AB2-43FB-9EBC-628E989DCBFD}" "AspNetVersion" = "8:4.0.30319.0" "RestartWWWService" = "11:FALSE" "RemovePreviousVersions" = "11:FALSE" "DetectNewerInstalledVersion" = "11:TRUE" "InstallAllUsers" = "11:FALSE" - "ProductVersion" = "8:1.6.2" + "ProductVersion" = "8:1.6.3" "Manufacturer" = "8:Log2Console" "ARPHELPTELEPHONE" = "8:" "ARPHELPLINK" = "8:https://github.com/DewJunkie/Log2Console" diff --git a/src/Log2ConsoleSetup/MakeRelease.cmd b/src/Log2ConsoleSetup/MakeRelease.cmd index b17089f..9b6831b 100644 --- a/src/Log2ConsoleSetup/MakeRelease.cmd +++ b/src/Log2ConsoleSetup/MakeRelease.cmd @@ -1,4 +1,4 @@ -set version=1.6.2 +set version=1.6.3 pushd Release diff --git a/src/Tests/Test/Test.csproj b/src/Tests/Test/Test.csproj index 0f2f087..a29e26e 100644 --- a/src/Tests/Test/Test.csproj +++ b/src/Tests/Test/Test.csproj @@ -41,7 +41,7 @@ true full false - bin\Debug\ + ..\bin\Debug\ DEBUG;TRACE prompt 4 diff --git a/src/Tests/TestNLog/TestNLog.csproj b/src/Tests/TestNLog/TestNLog.csproj index 0d2ec30..761399c 100644 --- a/src/Tests/TestNLog/TestNLog.csproj +++ b/src/Tests/TestNLog/TestNLog.csproj @@ -17,7 +17,7 @@ true - bin\Debug\ + ..\bin\Debug\ DEBUG;TRACE full AnyCPU diff --git a/src/Tests/TestOther/TestOther.csproj b/src/Tests/TestOther/TestOther.csproj index 95dbc42..a64dbde 100644 --- a/src/Tests/TestOther/TestOther.csproj +++ b/src/Tests/TestOther/TestOther.csproj @@ -17,7 +17,7 @@ true full false - bin\Debug\ + ..\bin\Debug\ DEBUG;TRACE prompt 4 diff --git a/src/Tests/TestSerilog/Program.cs b/src/Tests/TestSerilog/Program.cs index cdbcc3f..5c8c385 100644 --- a/src/Tests/TestSerilog/Program.cs +++ b/src/Tests/TestSerilog/Program.cs @@ -24,19 +24,21 @@ static void Main(string[] args) .WriteTo.UDPSink(IPAddress.Loopback, 1337) .CreateLogger(); - Log.Verbose("Verbose"); - Log.Debug("Debug"); - Log.Information("Information"); - Log.Warning("Warning"); - Log.Error("Error"); - Log.Fatal("Fatal"); + var logger = Log.Logger.ForContext(); + + logger.Verbose("Verbose"); + logger.Debug("Debug"); + logger.Information("Information"); + logger.Warning("Warning"); + logger.Error("Error"); + logger.Fatal("Fatal"); var me = new Person("Duane", "123", "?"); - Log.Information("I just created {@Someone} at {Now}", me, DateTime.Now); + logger.Information("I just created {@Someone} at {Now}", me, DateTime.Now); int count = 1; - Log.Information("Create {Count} people", count); + logger.Information("Create {Count} people", count); var fruit = new string[] {"Apple", "Pear", "Orange"}; - Log.Information("In my bowl I have {Fruit}", fruit); + logger.Information("In my bowl I have {Fruit}", fruit); //Console.WriteLine("Enter a simple math statement. Operators supported are (+,-,/,*)"); //var line = ""; @@ -58,15 +60,17 @@ static void Main(string[] args) { Line1 = "Address2" }); - Log.Information("This person has multiple addresses {@Person}, 1st one is {@Address}", person, person.Addresses.FirstOrDefault()); - Log.Information("This person has multiple addresses {Person}, 1st one is {Address}", person, person.Addresses.FirstOrDefault()); + logger.Information("This person has multiple addresses {@Person}, 1st one is {@Address}", person, person.Addresses.FirstOrDefault()); + logger.Information("This person has multiple addresses {Person}, 1st one is {Address}", person, person.Addresses.FirstOrDefault()); + + logger.Information("This bool is {True}", true); + logger.Information("The number is {One}", 1); + logger.Information("The time is {Now}", DateTime.Now); + logger.Information("Googles uri is {Uri}", new Uri("http://google.com/")); - Log.Information("This bool is {True}", true); - Log.Information("The number is {One}", 1); - Log.Information("The time is {Now}", DateTime.Now); - Log.Information("Googles uri is {Uri}", new Uri("http://google.com/")); + logger.Information("Don't try to serialize this {$Person}", person); - Log.Information("Don't try to serialize this {$Person}", person); + Log.Warning("No context set on this one"); } static void Domath(string math) diff --git a/src/Tests/TestSerilog/TestSerilog.csproj b/src/Tests/TestSerilog/TestSerilog.csproj index 52fc05e..d1dac3d 100644 --- a/src/Tests/TestSerilog/TestSerilog.csproj +++ b/src/Tests/TestSerilog/TestSerilog.csproj @@ -18,7 +18,7 @@ true full false - bin\Debug\ + ..\bin\Debug\ DEBUG;TRACE prompt 4 From 65638cd0c0c23923efd376b484bcc32cc4aefa5d Mon Sep 17 00:00:00 2001 From: Duane McKinney Date: Sat, 17 Dec 2016 15:07:53 -0800 Subject: [PATCH 16/16] Fixed error with condensing a logger name when it was null. --- src/Log2Console/Receiver/UdpReceiver.cs | 15 ++++---- src/Log2ConsoleSetup/Log2ConsoleSetup.vdproj | 36 +++++++++++++++----- 2 files changed, 37 insertions(+), 14 deletions(-) diff --git a/src/Log2Console/Receiver/UdpReceiver.cs b/src/Log2Console/Receiver/UdpReceiver.cs index 70cdb38..46668db 100644 --- a/src/Log2Console/Receiver/UdpReceiver.cs +++ b/src/Log2Console/Receiver/UdpReceiver.cs @@ -166,19 +166,22 @@ private void Start() //logMsg.RootLoggerName = _remoteEndPoint.Address.ToString().Replace(".", "-"); //logMsg.LoggerName = string.Format("{0}_{1}", _remoteEndPoint.Address.ToString().Replace(".", "-"), logMsg.LoggerName); logMsg.RootLoggerName = logMsg.LoggerName; - if (CondenseCamelCase) + if (CondenseCamelCase && logMsg.LoggerName != null) { var newName = ""; var stopAt = logMsg.LoggerName.LastIndexOf('.'); - for (int i = 0; i < stopAt; i++) + if (stopAt > 0) { - if (Char.IsUpper(logMsg.LoggerName[i]) || logMsg.LoggerName[i] == '.') + for (int i = 0; i < stopAt; i++) { - newName += logMsg.LoggerName[i]; + if (Char.IsUpper(logMsg.LoggerName[i]) || logMsg.LoggerName[i] == '.') + { + newName += logMsg.LoggerName[i]; + } } + newName += logMsg.LoggerName.Substring(stopAt); + logMsg.RootLoggerName = newName; } - newName += logMsg.LoggerName.Substring(stopAt); - logMsg.RootLoggerName = newName; } logMsg.LoggerName = string.Format(":{1}.{0}", logMsg.LoggerName, _port); Notifiable.Notify(logMsg); diff --git a/src/Log2ConsoleSetup/Log2ConsoleSetup.vdproj b/src/Log2ConsoleSetup/Log2ConsoleSetup.vdproj index 72298f1..b8934a0 100644 --- a/src/Log2ConsoleSetup/Log2ConsoleSetup.vdproj +++ b/src/Log2ConsoleSetup/Log2ConsoleSetup.vdproj @@ -52,25 +52,25 @@ "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_9809A07FEC71D18B8AF8747EBBF1CBE3" + "OwnerKey" = "8:_C6619780B23063AE67BFD706FEEE78F0" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_A8CE65B1251180814087BE568C395C13" + "OwnerKey" = "8:_98FA069438F9D99E4468964C3BECE4C9" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_98FA069438F9D99E4468964C3BECE4C9" + "OwnerKey" = "8:_A8CE65B1251180814087BE568C395C13" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_C6619780B23063AE67BFD706FEEE78F0" + "OwnerKey" = "8:_9809A07FEC71D18B8AF8747EBBF1CBE3" "MsmSig" = "8:_UNDEFINED" } } @@ -175,6 +175,11 @@ "AssemblyAsmDisplayName" = "8:ICSharpCode.TextEditor, Version=3.0.0.3437, Culture=neutral, PublicKeyToken=4d61825e8dd49f1a, processorArchitecture=MSIL" "ScatterAssemblies" { + "_9809A07FEC71D18B8AF8747EBBF1CBE3" + { + "Name" = "8:ICSharpCode.TextEditor.dll" + "Attributes" = "3:512" + } } "SourcePath" = "8:ICSharpCode.TextEditor.dll" "TargetName" = "8:" @@ -201,6 +206,11 @@ "AssemblyAsmDisplayName" = "8:Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL" "ScatterAssemblies" { + "_98FA069438F9D99E4468964C3BECE4C9" + { + "Name" = "8:Newtonsoft.Json.dll" + "Attributes" = "3:512" + } } "SourcePath" = "8:Newtonsoft.Json.dll" "TargetName" = "8:" @@ -227,6 +237,11 @@ "AssemblyAsmDisplayName" = "8:log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL" "ScatterAssemblies" { + "_A8CE65B1251180814087BE568C395C13" + { + "Name" = "8:log4net.dll" + "Attributes" = "3:512" + } } "SourcePath" = "8:log4net.dll" "TargetName" = "8:" @@ -253,6 +268,11 @@ "AssemblyAsmDisplayName" = "8:RichTextBoxLinks, Version=1.0.6191.12180, Culture=neutral, processorArchitecture=MSIL" "ScatterAssemblies" { + "_C6619780B23063AE67BFD706FEEE78F0" + { + "Name" = "8:RichTextBoxLinks.dll" + "Attributes" = "3:512" + } } "SourcePath" = "8:RichTextBoxLinks.dll" "TargetName" = "8:" @@ -328,15 +348,15 @@ { "Name" = "8:Microsoft Visual Studio" "ProductName" = "8:Log2Console" - "ProductCode" = "8:{DABF7879-B755-475A-A72C-3C4A2C17D8DE}" - "PackageCode" = "8:{DEAEF41A-73B0-420A-B511-0868B9C0B464}" + "ProductCode" = "8:{F6371FE1-0BAE-448C-91E9-63F3F64FFD41}" + "PackageCode" = "8:{5F6AA311-4DFA-401D-9314-903D41EA9467}" "UpgradeCode" = "8:{2A137B8E-9AB2-43FB-9EBC-628E989DCBFD}" "AspNetVersion" = "8:4.0.30319.0" "RestartWWWService" = "11:FALSE" - "RemovePreviousVersions" = "11:FALSE" + "RemovePreviousVersions" = "11:TRUE" "DetectNewerInstalledVersion" = "11:TRUE" "InstallAllUsers" = "11:FALSE" - "ProductVersion" = "8:1.6.3" + "ProductVersion" = "8:1.6.4" "Manufacturer" = "8:Log2Console" "ARPHELPTELEPHONE" = "8:" "ARPHELPLINK" = "8:https://github.com/DewJunkie/Log2Console"