diff --git a/NLog.Extensions.Logging.sln b/NLog.Extensions.Logging.sln
index cf14af65..631b3ddf 100644
--- a/NLog.Extensions.Logging.sln
+++ b/NLog.Extensions.Logging.sln
@@ -8,6 +8,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
ProjectSection(SolutionItems) = preProject
appveyor.yml = appveyor.yml
build.ps1 = build.ps1
+ CHANGELOG.MD = CHANGELOG.MD
README.md = README.md
EndProjectSection
EndProject
diff --git a/build.ps1 b/build.ps1
index 90751251..b9abb9e0 100644
--- a/build.ps1
+++ b/build.ps1
@@ -2,8 +2,8 @@
# creates NuGet package at \artifacts
dotnet --version
-$versionPrefix = "1.4.0"
-$versionSuffix = ""
+$versionPrefix = "1.5.0"
+$versionSuffix = "rc1"
$versionFile = $versionPrefix + "." + ${env:APPVEYOR_BUILD_NUMBER}
$versionProduct = $versionPrefix;
if (-Not $versionSuffix.Equals(""))
diff --git a/examples/NetCore2/ConsoleExample/ConsoleExample.csproj b/examples/NetCore2/ConsoleExample/ConsoleExample.csproj
index b86064c9..c5eefde4 100644
--- a/examples/NetCore2/ConsoleExample/ConsoleExample.csproj
+++ b/examples/NetCore2/ConsoleExample/ConsoleExample.csproj
@@ -11,7 +11,6 @@
-
diff --git a/examples/NetCore2/ConsoleExample/Program.cs b/examples/NetCore2/ConsoleExample/Program.cs
index 8eda3269..931557a2 100644
--- a/examples/NetCore2/ConsoleExample/Program.cs
+++ b/examples/NetCore2/ConsoleExample/Program.cs
@@ -12,6 +12,7 @@ internal class Program
private static void Main()
{
var logger = LogManager.GetCurrentClassLogger();
+
try
{
var config = new ConfigurationBuilder()
@@ -19,6 +20,8 @@ private static void Main()
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.Build();
+ LogManager.Configuration = new NLogLoggingConfiguration(config.GetSection("NLog"));
+
var servicesProvider = BuildDi(config);
using (servicesProvider as IDisposable)
{
diff --git a/examples/NetCore2/ConsoleExample/appsettings.json b/examples/NetCore2/ConsoleExample/appsettings.json
index daabc235..352cad2f 100644
--- a/examples/NetCore2/ConsoleExample/appsettings.json
+++ b/examples/NetCore2/ConsoleExample/appsettings.json
@@ -5,5 +5,43 @@
"ParseMessageTemplates": true,
"CaptureMessageProperties": true
}
+ },
+ "NLog": {
+ "autoreload": true,
+ "internalLogLevel": "Info",
+ "internalLogFile": "c:/temp/console-example-internal.log",
+ "throwConfigExceptions": true,
+ "targets": {
+ "console": {
+ "type": "Console",
+ "layout": "${date}|${level:uppercase=true}|${message} ${exception:format=tostring}|${logger}|${all-event-properties}"
+ },
+ "file": {
+ "type": "AsyncWrapper",
+ "target": {
+ "wrappedFile": {
+ "type": "File",
+ "fileName": "c:/temp/console-example.log",
+ "layout": {
+ "type": "JsonLayout",
+ "Attributes": [
+ { "name": "timestamp", "layout": "${date:format=o}" },
+ { "name": "level", "layout": "${level}" },
+ { "name": "logger", "layout": "${logger}" },
+ { "name": "message", "layout": "${message:raw=true}" },
+ { "name": "properties", "encode": false, "layout": { "type": "JsonLayout", "includeallproperties": "true" } }
+ ]
+ }
+ }
+ }
+ }
+ },
+ "rules": [
+ {
+ "logger": "*",
+ "minLevel": "Trace",
+ "writeTo": "File,Console"
+ }
+ ]
}
}
\ No newline at end of file
diff --git a/src/NLog.Extensions.Logging/Config/NLogLoggingConfiguration.cs b/src/NLog.Extensions.Logging/Config/NLogLoggingConfiguration.cs
new file mode 100644
index 00000000..8f461467
--- /dev/null
+++ b/src/NLog.Extensions.Logging/Config/NLogLoggingConfiguration.cs
@@ -0,0 +1,108 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.Extensions.Configuration;
+using NLog.Config;
+
+namespace NLog.Extensions.Logging
+{
+ ///
+ /// Configures NLog through Microsoft Extension Configuration section (Ex from appsettings.json)
+ ///
+ public class NLogLoggingConfiguration : LoggingConfigurationParser
+ {
+ private readonly Action