Skip to content

Loading…

#1 switched from log4net to NLog #5

Merged
merged 2 commits into from

1 participant

@adamralph
config-r member

No description provided.

@adamralph adamralph merged commit 2b79870 into config-r:master

1 check passed

Details default TeamCity Build ConfigR :: ConfigR Samples finished: Running
@adamralph adamralph deleted the adamralph:1 branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
View
8 src/ConfigR.Samples.ConsoleApplication/ConfigR.Samples.ConsoleApplication.csproj
@@ -52,8 +52,12 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
- <Reference Include="Common.Logging">
- <HintPath>..\packages\Common.Logging.2.1.2\lib\net40\Common.Logging.dll</HintPath>
+ <Reference Include="Common.Logging, Version=2.2.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\packages\Common.Logging.2.2.0\lib\net40\Common.Logging.dll</HintPath>
+ </Reference>
+ <Reference Include="Common.Logging.Core">
+ <HintPath>..\packages\Common.Logging.Core.2.2.0\lib\net40\Common.Logging.Core.dll</HintPath>
</Reference>
<Reference Include="ConfigR, Version=0.10.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
View
2 src/ConfigR.Samples.ConsoleApplication/Program.cs
@@ -14,7 +14,7 @@ public static class Program
{
public static void Main(string[] args)
{
- LogManager.Adapter = new ConsoleOutLoggerFactoryAdapter(LogLevel.Debug, false, true, true, null);
+ LogManager.Adapter = new ConsoleOutLoggerFactoryAdapter(LogLevel.Info, false, true, true, null);
// you can retreive settings as their underlying type
var count = Config.Global.Get<int>("Count");
View
2 src/ConfigR.Samples.ConsoleApplication/app.config
@@ -8,7 +8,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Common.Logging" publicKeyToken="af08829b84f0328e" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-2.1.2.0" newVersion="2.1.2.0" />
+ <bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
View
3 src/ConfigR.Samples.ConsoleApplication/packages.config
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Common.Logging" version="2.1.2" targetFramework="net45" />
+ <package id="Common.Logging" version="2.2.0" targetFramework="net45" />
+ <package id="Common.Logging.Core" version="2.2.0" targetFramework="net45" />
<package id="ConfigR" version="0.10.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.1" targetFramework="net45" />
<package id="Roslyn.Compilers.Common" version="1.2.20906.2" targetFramework="net45" />
View
18 src/ConfigR.Samples.Scheduler/ConfigR.Samples.Scheduler.csproj
@@ -52,22 +52,26 @@
<Compile Include="Schedule.cs" />
</ItemGroup>
<ItemGroup>
- <Reference Include="Common.Logging">
- <HintPath>..\packages\Common.Logging.2.1.2\lib\net40\Common.Logging.dll</HintPath>
+ <Reference Include="Common.Logging, Version=2.2.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\packages\Common.Logging.2.2.0\lib\net40\Common.Logging.dll</HintPath>
+ </Reference>
+ <Reference Include="Common.Logging.Core">
+ <HintPath>..\packages\Common.Logging.Core.2.2.0\lib\net40\Common.Logging.Core.dll</HintPath>
</Reference>
- <Reference Include="Common.Logging.Log4Net">
- <HintPath>..\packages\Common.Logging.Log4Net.2.0.1\lib\net20\Common.Logging.Log4Net.dll</HintPath>
+ <Reference Include="Common.Logging.NLog20">
+ <HintPath>..\packages\Common.Logging.NLog20.2.2.0\lib\net40\Common.Logging.NLog20.dll</HintPath>
</Reference>
<Reference Include="ConfigR, Version=0.10.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\ConfigR.0.10.0\lib\net45\ConfigR.dll</HintPath>
</Reference>
- <Reference Include="log4net">
- <HintPath>..\packages\log4net.1.2.10\lib\2.0\log4net.dll</HintPath>
- </Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
+ <Reference Include="NLog">
+ <HintPath>..\packages\NLog.2.0.0.2000\lib\net40\NLog.dll</HintPath>
+ </Reference>
<Reference Include="Roslyn.Compilers">
<HintPath>..\packages\Roslyn.Compilers.Common.1.2.20906.2\lib\net45\Roslyn.Compilers.dll</HintPath>
</Reference>
View
8 src/ConfigR.Samples.Scheduler/ConfigR.Samples.Scheduler.exe.csx
@@ -1,6 +1,8 @@
#r "ConfigR.Samples.Scheduler.exe"
+#r "Common.Logging.Core.dll"
using System;
+using Common.Logging;
using ConfigR.Samples.Scheduler;
Add(
@@ -11,7 +13,7 @@ Add(
{
Action = () =>
{
- Console.WriteLine("{0}: The 1st schedule is sending some emails!", DateTime.Now.ToString("o"));
+ LogManager.GetCurrentClassLogger().Info("The 1st schedule is sending some emails!");
// send some emails
},
NextRun = DateTime.Now.AddSeconds(2),
@@ -21,7 +23,7 @@ Add(
{
Action = () =>
{
- Console.WriteLine("{0}: The 2nd schedule is downloading some reports!", DateTime.Now.ToString("o"));
+ LogManager.GetCurrentClassLogger().Info("The 2nd schedule is downloading some reports!");
// download some reports
},
NextRun = DateTime.Now.AddSeconds(3),
@@ -31,7 +33,7 @@ Add(
{
Action = () =>
{
- Console.WriteLine("{0}: The 3rd schedule is performing some housekeeping!", DateTime.Now.ToString("o"));
+ LogManager.GetCurrentClassLogger().Info("The 3rd schedule is performing some housekeeping!");
// perform some housekeeping
},
NextRun = DateTime.Now.AddSeconds(4),
View
37 src/ConfigR.Samples.Scheduler/app.config
@@ -4,36 +4,25 @@
<sectionGroup name="common">
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
</sectionGroup>
- <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
+ <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" />
</configSections>
<common>
<logging>
- <factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4net">
+ <factoryAdapter type="Common.Logging.NLog.NLogLoggerFactoryAdapter, Common.Logging.NLog20">
<arg key="configType" value="INLINE" />
</factoryAdapter>
</logging>
</common>
- <log4net>
- <appender name="Console" type="log4net.Appender.ConsoleAppender">
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%-5level: %message%newline" />
- </layout>
- </appender>
- <appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
- <file value="${TEMP}\ConfigR.Scheduler.log" />
- <appendToFile value="false" />
- <maximumFileSize value="1GB" />
- <maxSizeRollBackups value="0" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date %-2thread %-50logger %-5level: %message%newline" />
- </layout>
- </appender>
- <root>
- <level value="ALL" />
- <appender-ref ref="Console" />
- <appender-ref ref="RollingFile" />
- </root>
- </log4net>
+ <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <targets>
+ <target name="console" xsi:type="ColoredConsole" layout="${pad:padding=5:inner=${uppercase:inner=${level}}}: ${message}" />
+ <target name="file" xsi:type="File" fileName="${tempdir:file=ConfigR.Samples.Scheduler.log}" deleteOldFileOnStartup="true" layout="${date} ${pad:padding=2:inner=${threadid}} ${pad:padding=50:inner=${logger}} ${pad:padding=5:inner=${uppercase:inner=${level}}}: ${message}" />
+ </targets>
+ <rules>
+ <logger name="*" minlevel="Info" writeTo="console" />
+ <logger name="*" minlevel="Trace" writeTo="file" />
+ </rules>
+ </nlog>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
@@ -45,7 +34,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Common.Logging" publicKeyToken="af08829b84f0328e" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-2.1.2.0" newVersion="2.1.2.0" />
+ <bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
View
7 src/ConfigR.Samples.Scheduler/packages.config
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Common.Logging" version="2.1.2" targetFramework="net45" />
- <package id="Common.Logging.Log4Net" version="2.0.1" targetFramework="net45" />
+ <package id="Common.Logging" version="2.2.0" targetFramework="net45" />
+ <package id="Common.Logging.Core" version="2.2.0" targetFramework="net45" />
+ <package id="Common.Logging.NLog20" version="2.2.0" targetFramework="net45" />
<package id="ConfigR" version="0.10.0" targetFramework="net45" />
- <package id="log4net" version="1.2.10" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.1" targetFramework="net45" />
+ <package id="NLog" version="2.0.0.2000" targetFramework="net45" />
<package id="Roslyn.Compilers.Common" version="1.2.20906.2" targetFramework="net45" />
<package id="Roslyn.Compilers.CSharp" version="1.2.20906.2" targetFramework="net45" />
<package id="ScriptCs.Contracts" version="0.9.0" targetFramework="net45" />
View
8 src/ConfigR.Samples.WebApplication/ConfigR.Samples.WebApplication.csproj
@@ -46,8 +46,12 @@
<CodeAnalysisRuleSet>..\ConfigR.Samples.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
- <Reference Include="Common.Logging">
- <HintPath>..\packages\Common.Logging.2.1.2\lib\net40\Common.Logging.dll</HintPath>
+ <Reference Include="Common.Logging, Version=2.2.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\packages\Common.Logging.2.2.0\lib\net40\Common.Logging.dll</HintPath>
+ </Reference>
+ <Reference Include="Common.Logging.Core">
+ <HintPath>..\packages\Common.Logging.Core.2.2.0\lib\net40\Common.Logging.Core.dll</HintPath>
</Reference>
<Reference Include="ConfigR, Version=0.10.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
View
11 src/ConfigR.Samples.WebApplication/Web.config
@@ -22,4 +22,13 @@
<handlers>
<add name="Nancy" verb="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" path="*" />
</handlers>
- </system.webServer></configuration>
+ </system.webServer>
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="Common.Logging" publicKeyToken="af08829b84f0328e" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+</configuration>
View
3 src/ConfigR.Samples.WebApplication/packages.config
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Common.Logging" version="2.1.2" targetFramework="net45" />
+ <package id="Common.Logging" version="2.2.0" targetFramework="net45" />
+ <package id="Common.Logging.Core" version="2.2.0" targetFramework="net45" />
<package id="ConfigR" version="0.10.0" targetFramework="net45" />
<package id="Nancy" version="0.22.2" targetFramework="net45" />
<package id="Nancy.Hosting.Aspnet" version="0.22.2" targetFramework="net45" />
View
18 src/ConfigR.Samples.WindowsService/ConfigR.Samples.WindowsService.csproj
@@ -51,22 +51,26 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
- <Reference Include="Common.Logging">
- <HintPath>..\packages\Common.Logging.2.1.2\lib\net40\Common.Logging.dll</HintPath>
+ <Reference Include="Common.Logging, Version=2.2.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\packages\Common.Logging.2.2.0\lib\net40\Common.Logging.dll</HintPath>
+ </Reference>
+ <Reference Include="Common.Logging.Core">
+ <HintPath>..\packages\Common.Logging.Core.2.2.0\lib\net40\Common.Logging.Core.dll</HintPath>
</Reference>
- <Reference Include="Common.Logging.Log4Net">
- <HintPath>..\packages\Common.Logging.Log4Net.2.0.1\lib\net20\Common.Logging.Log4Net.dll</HintPath>
+ <Reference Include="Common.Logging.NLog20">
+ <HintPath>..\packages\Common.Logging.NLog20.2.2.0\lib\net40\Common.Logging.NLog20.dll</HintPath>
</Reference>
<Reference Include="ConfigR, Version=0.10.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\ConfigR.0.10.0\lib\net45\ConfigR.dll</HintPath>
</Reference>
- <Reference Include="log4net">
- <HintPath>..\packages\log4net.1.2.10\lib\2.0\log4net.dll</HintPath>
- </Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
+ <Reference Include="NLog">
+ <HintPath>..\packages\NLog.2.0.0.2000\lib\net40\NLog.dll</HintPath>
+ </Reference>
<Reference Include="Roslyn.Compilers">
<HintPath>..\packages\Roslyn.Compilers.Common.1.2.20906.2\lib\net45\Roslyn.Compilers.dll</HintPath>
</Reference>
View
37 src/ConfigR.Samples.WindowsService/app.config
@@ -4,36 +4,25 @@
<sectionGroup name="common">
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
</sectionGroup>
- <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
+ <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" />
</configSections>
<common>
<logging>
- <factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4net">
+ <factoryAdapter type="Common.Logging.NLog.NLogLoggerFactoryAdapter, Common.Logging.NLog20">
<arg key="configType" value="INLINE" />
</factoryAdapter>
</logging>
</common>
- <log4net>
- <appender name="Console" type="log4net.Appender.ConsoleAppender">
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%-5level: %message%newline" />
- </layout>
- </appender>
- <appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
- <file value="${TEMP}\ConfigR.WindowsService.log" />
- <appendToFile value="false" />
- <maximumFileSize value="1GB" />
- <maxSizeRollBackups value="0" />
- <layout type="log4net.Layout.PatternLayout">
- <conversionPattern value="%date %-2thread %-50logger %-5level: %message%newline" />
- </layout>
- </appender>
- <root>
- <level value="ALL" />
- <appender-ref ref="Console" />
- <appender-ref ref="RollingFile" />
- </root>
- </log4net>
+ <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <targets>
+ <target name="console" xsi:type="ColoredConsole" layout="${pad:padding=5:inner=${uppercase:inner=${level}}}: ${message}" />
+ <target name="file" xsi:type="File" fileName="${tempdir:file=ConfigR.Samples.WindowsService.log}" deleteOldFileOnStartup="true" layout="${date} ${pad:padding=2:inner=${threadid}} ${pad:padding=50:inner=${logger}} ${pad:padding=5:inner=${uppercase:inner=${level}}}: ${message}" />
+ </targets>
+ <rules>
+ <logger name="*" minlevel="Info" writeTo="console" />
+ <logger name="*" minlevel="Trace" writeTo="file" />
+ </rules>
+ </nlog>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
@@ -45,7 +34,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Common.Logging" publicKeyToken="af08829b84f0328e" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-2.1.2.0" newVersion="2.1.2.0" />
+ <bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
View
7 src/ConfigR.Samples.WindowsService/packages.config
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Common.Logging" version="2.1.2" targetFramework="net45" />
- <package id="Common.Logging.Log4Net" version="2.0.1" targetFramework="net45" />
+ <package id="Common.Logging" version="2.2.0" targetFramework="net45" />
+ <package id="Common.Logging.Core" version="2.2.0" targetFramework="net45" />
+ <package id="Common.Logging.NLog20" version="2.2.0" targetFramework="net45" />
<package id="ConfigR" version="0.10.0" targetFramework="net45" />
- <package id="log4net" version="1.2.10" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.1" targetFramework="net45" />
+ <package id="NLog" version="2.0.0.2000" targetFramework="net45" />
<package id="Roslyn.Compilers.Common" version="1.2.20906.2" targetFramework="net45" />
<package id="Roslyn.Compilers.CSharp" version="1.2.20906.2" targetFramework="net45" />
<package id="ScriptCs.Contracts" version="0.9.0" targetFramework="net45" />
Something went wrong with that request. Please try again.