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/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. 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. diff --git a/src/Log2Console/Log/LogMessage.cs b/src/Log2Console/Log/LogMessage.cs index 487a38b..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)) @@ -167,8 +172,12 @@ 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 "); } + // 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 22babe0..c6ad330 100644 --- a/src/Log2Console/Log2Console.csproj +++ b/src/Log2Console/Log2Console.csproj @@ -77,14 +77,14 @@ false - - ..\packages\ICSharpCode.TextEditor.3.2.1.6466\lib\Net20\ICSharpCode.TextEditor.dll - True - False ..\External\log4net.dll + + ..\packages\Newtonsoft.Json.9.0.1\lib\net40\Newtonsoft.Json.dll + True + @@ -121,6 +121,7 @@ MainForm.cs + @@ -274,6 +275,10 @@ + + {2d18be89-d210-49eb-a9dd-2246fbb3df6d} + ICSharpCode.TextEditor + {8B833B00-BB4C-4FAF-B6C4-BF77824F96A1} RichTextBoxLinks diff --git a/src/Log2Console/Properties/AssemblyInfo.cs b/src/Log2Console/Properties/AssemblyInfo.cs index ba7f7db..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.2")] -[assembly: AssemblyFileVersion("1.6.0.2")] +[assembly: AssemblyVersion("1.6.*")] +//[assembly: AssemblyFileVersion("1.6.*")] diff --git a/src/Log2Console/Receiver/ReceiverUtils.cs b/src/Log2Console/Receiver/ReceiverUtils.cs index 3ad837b..2c44e33 100644 --- a/src/Log2Console/Receiver/ReceiverUtils.cs +++ b/src/Log2Console/Receiver/ReceiverUtils.cs @@ -1,8 +1,10 @@ using Log2Console.Log; using System; +using System.Collections.Generic; using System.ComponentModel; using System.IO; using System.Text; +using System.Text.RegularExpressions; using System.Xml; namespace Log2Console.Receiver @@ -24,7 +26,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 +55,92 @@ 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) + { + var buffer = new byte[4096]; + int bytesRead = 0; + int startPos = 0; + while((bytesRead = logStream.Read(buffer, startPos, buffer.Length - startPos)) > 0) + { + 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. + var matches = Regex.Matches(xmlText, $"<(/?)\\s*(log4j:event)[^<>]*(/?)>"); + + // Break up the log messages into single log messages before processing. + foreach (Match match in matches) + { + bool IsBeginElement = String.IsNullOrWhiteSpace(match.Groups[1].Value); + bool IsEmptyElement = match.Value.EndsWith("/>"); + if (IsBeginElement) + { + // Some data before the start tag, this will probably fail. + if (startPos < match.Index) + { + yield return TryParseLog4JXmlLogEvent(xmlText.Substring(startPos, match.Index - startPos), defaultLogger); + } + // Empty XML Element, this will always fail, but go ahead and try anyway. + if (IsEmptyElement) + { + yield return TryParseLog4JXmlLogEvent(xmlText.Substring(match.Index, match.Length), defaultLogger); + leftOversPos = startPos = match.Index + match.Length; + } + else + { + startPos = match.Index; + } + } + else // End element process outer xml + { + 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; + } + } + /// /// Parse LOG4JXml from string /// @@ -99,7 +187,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/SerilogParser.cs b/src/Log2Console/Receiver/SerilogParser.cs new file mode 100644 index 0000000..3ff9637 --- /dev/null +++ b/src/Log2Console/Receiver/SerilogParser.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +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()) + { +#if DEBUG + Debug.WriteLine($"{child.Name}={child.Value}"); +#endif + 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/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/Log2Console/Receiver/UdpReceiver.cs b/src/Log2Console/Receiver/UdpReceiver.cs index 09a8d71..46668db 100644 --- a/src/Log2Console/Receiver/UdpReceiver.cs +++ b/src/Log2Console/Receiver/UdpReceiver.cs @@ -61,6 +61,21 @@ public int BufferSize set { _bufferSize = value; } } + public enum LogFormat + { + Log4J, + Serilog + } + + [Category("Configuration")] + [DisplayName("Log Format")] + public LogFormat LogFormatType { get; set; } = LogFormat.Log4J; + + [Category("Configuration")] + [DisplayName("Condense Camel Case")] + public bool CondenseCamelCase { get; set; } = true; + + #region IReceiver Members @@ -75,7 +90,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 +153,39 @@ private void Start() if (Notifiable == null) continue; - LogMessage logMsg = ReceiverUtils.ParseLog4JXmlLogEvent(loggingEvent, "UdpLogger"); - logMsg.RootLoggerName = _remoteEndPoint.Address.ToString().Replace(".", "-"); - logMsg.LoggerName = string.Format("{0}_{1}", _remoteEndPoint.Address.ToString().Replace(".", "-"), logMsg.LoggerName); + 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); + logMsg.RootLoggerName = logMsg.LoggerName; + if (CondenseCamelCase && logMsg.LoggerName != null) + { + var newName = ""; + var stopAt = logMsg.LoggerName.LastIndexOf('.'); + if (stopAt > 0) + { + 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); + } 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/Log2Console/res/collapse_all.png b/src/Log2Console/res/collapse_all.png new file mode 100644 index 0000000..1674422 Binary files /dev/null and b/src/Log2Console/res/collapse_all.png differ diff --git a/src/Log2Console/res/pin.png b/src/Log2Console/res/pin.png new file mode 100644 index 0000000..8ce8574 Binary files /dev/null and b/src/Log2Console/res/pin.png differ diff --git a/src/Log2Console/res/unselect.png b/src/Log2Console/res/unselect.png new file mode 100644 index 0000000..67c442b Binary files /dev/null and b/src/Log2Console/res/unselect.png differ diff --git a/src/Log2ConsoleSetup/Log2ConsoleSetup.vdproj b/src/Log2ConsoleSetup/Log2ConsoleSetup.vdproj new file mode 100644 index 0000000..b8934a0 --- /dev/null +++ b/src/Log2ConsoleSetup/Log2ConsoleSetup.vdproj @@ -0,0 +1,915 @@ +"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:_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" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_9809A07FEC71D18B8AF8747EBBF1CBE3" + "MsmSig" = "8:_UNDEFINED" + } + } + "Configurations" + { + "Debug" + { + "DisplayName" = "8:Debug" + "IsDebugOnly" = "11:TRUE" + "IsReleaseOnly" = "11:FALSE" + "OutputFilename" = "8:Debug\\Log2ConsoleSetup.msi" + "PackageFilesAs" = "3:1" + "PackageFileSize" = "3:-2147483648" + "CabType" = "3:1" + "Compression" = "3:2" + "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" + } + } + } + } + "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: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" + { + "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:{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:TRUE" + "DetectNewerInstalledVersion" = "11:TRUE" + "InstallAllUsers" = "11:FALSE" + "ProductVersion" = "8:1.6.4" + "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 1.6 RC1" + "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:32512" + "Transitive" = "11:FALSE" + "Target" = "8:_F03687E2A6554E48B667DE4A0AA1552E" + "Folder" = "8:_BFCE4E478F5E4691AF1B1CCD67159EF2" + "WorkingFolder" = "8:_B42E984976D74777AEFB598EDD0F212D" + "Icon" = "8:_F03687E2A6554E48B667DE4A0AA1552E" + "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/Log2ConsoleSetup/MakeRelease.cmd b/src/Log2ConsoleSetup/MakeRelease.cmd new file mode 100644 index 0000000..9b6831b --- /dev/null +++ b/src/Log2ConsoleSetup/MakeRelease.cmd @@ -0,0 +1,18 @@ +set version=1.6.3 + + +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/LogFmwk.sln b/src/LogFmwk.sln index 5669cbe..709bfd0 100644 --- a/src/LogFmwk.sln +++ b/src/LogFmwk.sln @@ -1,70 +1,45 @@  -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{29A745D4-5A2F-4170-A0F1-54C77F151892}" -EndProject +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +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}" 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 +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(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 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 {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 @@ -77,10 +52,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}.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 @@ -93,6 +64,33 @@ 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 + {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 + {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 @@ -100,5 +98,9 @@ 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} + {B7C629FF-9C17-4373-9695-1E84B3A816AC} = {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 92% rename from src/Test/Test.csproj rename to src/Tests/Test/Test.csproj index 8b53006..a29e26e 100644 --- a/src/Test/Test.csproj +++ b/src/Tests/Test/Test.csproj @@ -41,7 +41,7 @@ true full false - bin\Debug\ + ..\bin\Debug\ DEBUG;TRACE prompt 4 @@ -51,15 +51,15 @@ pdbonly true - bin\Release\ + ..\bin\Release\ TRACE prompt 4 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/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/Tests/Test/packages.config b/src/Tests/Test/packages.config new file mode 100644 index 0000000..b8fa84f --- /dev/null +++ b/src/Tests/Test/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file 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 89% rename from src/TestNLog/TestNLog.csproj rename to src/Tests/TestNLog/TestNLog.csproj index 4da9938..761399c 100644 --- a/src/TestNLog/TestNLog.csproj +++ b/src/Tests/TestNLog/TestNLog.csproj @@ -17,7 +17,7 @@ true - bin\Debug\ + ..\bin\Debug\ DEBUG;TRACE full AnyCPU @@ -31,7 +31,7 @@ true - bin\Release\ + ..\bin\Release\ TRACE true pdbonly @@ -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/Tests/TestNLog/app.config b/src/Tests/TestNLog/app.config new file mode 100644 index 0000000..c24356f --- /dev/null +++ b/src/Tests/TestNLog/app.config @@ -0,0 +1,6 @@ + + + + + + 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..a10553a --- /dev/null +++ b/src/Tests/TestOther/Program.cs @@ -0,0 +1,105 @@ +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, "comments in the middle", + logBody.Replace("", "!-- Comments anyone -->")); + + SendLogMessage(stream, "Extra spaces in open", + logBody.Replace("", "")); + + SendLogMessage(stream, "Extra spaces in close", + logBody.Replace("", "")); + + 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(); + } + Console.WriteLine("x to exit, anything else to continue"); + key = Console.ReadKey(); + } + } + + 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); + } + } +} 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..a64dbde --- /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 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/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 diff --git a/src/Tests/TestSerilog/Person.cs b/src/Tests/TestSerilog/Person.cs new file mode 100644 index 0000000..2900658 --- /dev/null +++ b/src/Tests/TestSerilog/Person.cs @@ -0,0 +1,28 @@ +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; + + public List
Addresses { get; set; } + } +} diff --git a/src/Tests/TestSerilog/Program.cs b/src/Tests/TestSerilog/Program.cs new file mode 100644 index 0000000..5c8c385 --- /dev/null +++ b/src/Tests/TestSerilog/Program.cs @@ -0,0 +1,115 @@ +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, 1337) + .CreateLogger(); + + 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", "?"); + logger.Information("I just created {@Someone} at {Now}", me, DateTime.Now); + int count = 1; + logger.Information("Create {Count} people", count); + var fruit = new string[] {"Apple", "Pear", "Orange"}; + logger.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"); + + 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" + }); + 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/")); + + logger.Information("Don't try to serialize this {$Person}", person); + + Log.Warning("No context set on this one"); + } + + 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..d1dac3d --- /dev/null +++ b/src/Tests/TestSerilog/TestSerilog.csproj @@ -0,0 +1,91 @@ + + + + + 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