Skip to content

Commit

Permalink
Updated nuget packages.
Browse files Browse the repository at this point in the history
Moved sample app here.
  • Loading branch information
calloncampbell committed Jan 28, 2018
1 parent ee3d60d commit b40160d
Show file tree
Hide file tree
Showing 13 changed files with 416 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Build.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
param(
[String] $majorMinor = "5.7", # 5.7
[String] $patch = "1", # $env:APPVEYOR_BUILD_VERSION
[String] $patch = "2", # $env:APPVEYOR_BUILD_VERSION
[String] $customLogger = "", # C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll
[Switch] $notouch,
[String] $project = "ReflectSoftware.Insight.Extensions.Log4Net"
Expand Down
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## Change Log ##

#### Version 5.7.2 ####
* Updated to ReflectInsight v5.7.1.1
* Updated reference to Newtonsoft.Json v10.0.3
* Moved sample here

#### Version 5.7.1 ####
* Updated to ReflectInsight v5.7.1.1
* Updated reference to Newtonsoft.Json v10.0.2
Expand Down
21 changes: 18 additions & 3 deletions ReflectSoftware.Insight.Extensions.Log4Net 4.5.sln
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2026
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReflectSoftware.Insight.Extensions.Log4net 4.5", "src\ReflectSoftware.Insight.Extensions.Log4net 4.5.csproj", "{2CFB2E87-1C47-4E78-ADDC-99F246471FC1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Solution Items", "_Solution Items", "{5083DB16-D99D-48E4-8B72-90F9AFD54F7C}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "assets", "assets", "{5083DB16-D99D-48E4-8B72-90F9AFD54F7C}"
ProjectSection(SolutionItems) = preProject
Build.ps1 = Build.ps1
CHANGES.md = CHANGES.md
Expand All @@ -18,6 +18,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{F4B1F5B9-299
src\ReflectSoftware.Insight.Extensions.Log4net.nuspec = src\ReflectSoftware.Insight.Extensions.Log4net.nuspec
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sample", "Sample", "{243A6E95-6CA0-4A77-8324-66B9DE160466}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{4E25032C-D770-4050-948B-4083EF8BD1E1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReflectInsight.Extensions.Log4net.Sample", "Sample\ReflectInsight.Extensions.Log4Net.Sample\ReflectInsight.Extensions.Log4net.Sample.csproj", "{DDCB1251-AC79-45B3-96E4-27B5B995B196}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -28,11 +34,20 @@ Global
{2CFB2E87-1C47-4E78-ADDC-99F246471FC1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2CFB2E87-1C47-4E78-ADDC-99F246471FC1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2CFB2E87-1C47-4E78-ADDC-99F246471FC1}.Release|Any CPU.Build.0 = Release|Any CPU
{DDCB1251-AC79-45B3-96E4-27B5B995B196}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DDCB1251-AC79-45B3-96E4-27B5B995B196}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DDCB1251-AC79-45B3-96E4-27B5B995B196}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DDCB1251-AC79-45B3-96E4-27B5B995B196}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{2CFB2E87-1C47-4E78-ADDC-99F246471FC1} = {4E25032C-D770-4050-948B-4083EF8BD1E1}
{F4B1F5B9-2992-4AF1-B675-FDA0E1A1ACF5} = {5083DB16-D99D-48E4-8B72-90F9AFD54F7C}
{DDCB1251-AC79-45B3-96E4-27B5B995B196} = {243A6E95-6CA0-4A77-8324-66B9DE160466}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2B090A81-0209-4592-9DC0-EB85A0A79D8B}
EndGlobalSection
EndGlobal
44 changes: 44 additions & 0 deletions Sample/ReflectInsight.Extensions.Log4Net.Sample/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="insightSettings" type="ReflectSoftware.Insight.ConfigurationHandler,ReflectSoftware.Insight" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>

<!-- Logging Configuration
Please make sure you update the Insight.config file property 'Copy to Output Directory' to 'Copy always'.
For more information on ReflectInsight and configuration help, visit http://reflectsoftware.com. -->
<insightSettings externalConfigSource="ReflectInsight.config" />

<log4net debug="false">
<appender name="MyLogAppender1" type="ReflectSoftware.Insight.Extensions.Log4net.LogAppender, ReflectSoftware.Insight.Extensions.Log4net">
<param name="InstanceName" value="log4netInstance1" />
<param name="DisplayLevel" value="true" />
<param name="DisplayLocation" value="true" />
</appender>

<root>
<appender-ref ref="MyLogAppender1" />
</root>
</log4net>

<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.15.0" newVersion="1.2.15.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="ReflectSoftware.Insight" publicKeyToken="c78ddbdaf1f32b08" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.7.0.1705" newVersion="5.7.0.1705" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
53 changes: 53 additions & 0 deletions Sample/ReflectInsight.Extensions.Log4Net.Sample/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Reflection;

using log4net;

// log4net stuff
[assembly: log4net.Config.XmlConfigurator(Watch = true)]

namespace Log4net_Sample
{
class Program
{
static void TestLog4net()
{
ILog log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

while (true)
{
Console.WriteLine("Press any key or 'q' to quit...");
ConsoleKeyInfo k = Console.ReadKey();
if (k.KeyChar == 'q')
{
break;
}

Exception ex = new Exception("This is my test exception!");

log.Info("[Enter]EnterMessage");
log.Info("My Info");
log.Info("My Info", ex);

log.Debug("My Debug");
log.Debug("My Debug", ex);

log.Warn("My Warn");
log.Warn("My Warn", ex);

log.Error("My Error");
log.Error("My Error", ex);

log.Fatal("My Fatal");
log.Fatal("My Fatal", ex);
log.Info("[Exit]ExitMessage");
}
}

static void Main(string[] args)
{
TestLog4net();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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("Log4net_Sample")]

// 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("764293de-1570-4d3a-864d-6911d415e220")]
82 changes: 82 additions & 0 deletions Sample/ReflectInsight.Extensions.Log4Net.Sample/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
Log4net Extension Sample

This sample demonstrates how to use the ReflectInsight Log4net Extension. The purpose of this sample is to show you how to leverage ReflectInsight with an pre-existing logging framework.

This sample also uses satellite configuration files, which are a practice that we recommend doing. For more information about satellite configuration files, please
see the satellite configuration sample and/or our online resource.

To get started with the Log4net Extension, please do the following:

1. Start by adding an application configuration file (app.config) to your project. If you already have one, then proceed to step #2.

2. Next add/update the configSections with a section for for "insightSettings":

<configSections>
<section name="insightSettings" type="ReflectSoftware.Insight.ConfigurationHandler,ReflectSoftware.Insight"/>
</configSections>

3. Then add a new section called <insightSettings></insightSettings> and add the externalConfigSource to point to your external ReflectInsight.config file:

<insightSettings externalConfigSource="ReflectInsight.config" />

4. Please make sure you update the ReflectInsight.config file property 'Copy to Output Directory' to 'Copy always'.

5. Next ensure you have configured you application with the applicable log4net configuration.

6. In your log4net configuration, add a new appender for the ReflectInsight Log4net extension:

<appender name="MyLogAppender1" type="ReflectSoftware.Insight.Extensions.Log4net.LogAppender, ReflectSoftware.Insight.Extensions.Log4net">
<param name="InstanceName" value="log4netInstance1" />
<param name="DisplayLevel" value="true" />
<param name="DisplayLocation" value="true" />
</appender>

7. Now update your log4net configuration <root> section with a reference to the ReflectInsight Log4net appender you just added in step #6.

<root>
<appender-ref ref="MyLogAppender1" />
</root>

8. Finally, you will need to configure the ReflectInsight.config file to hookup to the log4net appender. The following is the ReflectInsight.config file
configuration. The section that I would like to highlight is the <logManager> and <instance>. Notice that the instance being used
is the same name as the log4net appender.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<insightSettings>
<baseSettings>
<configChange enabled="true" />
<propagateException enabled="false" />
<exceptionEventTracker time="20" />
<debugMessageProcess enabled="true" />
</baseSettings>

<listenerGroups active="Debug">
<group name="Debug" enabled="true" maskIdentities="false">
<destinations>
<destination name="Viewer" enabled="true" filter="" details="Viewer" />
</destinations>
</group>
</listenerGroups>

<logManager>
<instance name="log4netInstance1" category="Log4net1" />
</logManager>
</insightSettings>
</configuration>

9. That's it your done!

Additional Resources

Getting started with the Log4net configuration
https://insightextensions.codeplex.com/wikipage?title=Getting%20Started%20with%20Log4net%20Extension&referringTitle=Documentation

Knowledge Base
http://reflectsoftware.uservoice.com/knowledgebase

User Feedback
http://reflectsoftware.uservoice.com/forums/158277-reflectinsight-feedback

Support
support@reflectsoftware.com
Loading

0 comments on commit b40160d

Please sign in to comment.