Skip to content

Commit

Permalink
Add Orchard.Logging module adding NLog to pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
jersiovic committed Nov 16, 2016
1 parent 8eebb83 commit b1701fd
Show file tree
Hide file tree
Showing 9 changed files with 137 additions and 1 deletion.
7 changes: 7 additions & 0 deletions Orchard.sln
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Orchard.Tokens.Abstractions
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Orchard.Deployment.Abstractions", "src\Orchard.Deployment.Abstractions\Orchard.Deployment.Abstractions.xproj", "{F889E955-77A9-44FA-8663-674BE39C23F0}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Orchard.Logging", "src\Orchard.Cms.Web\Modules\Orchard.Logging\Orchard.Logging.xproj", "{7E83C764-C822-4B8C-A690-E529CC9A1739}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Orchard.Deployment", "src\Orchard.Cms.Web\Modules\Orchard.Deployment\Orchard.Deployment.xproj", "{1BFFAE3E-8FA1-4DF9-B46F-08C94A88BC7E}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Orchard.Deployment.Remote", "src\Orchard.Cms.Web\Modules\Orchard.Deployment.Remote\Orchard.Deployment.Remote.xproj", "{EC006198-8769-4661-9335-883EF13E6672}"
Expand Down Expand Up @@ -451,6 +453,10 @@ Global
{F889E955-77A9-44FA-8663-674BE39C23F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F889E955-77A9-44FA-8663-674BE39C23F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F889E955-77A9-44FA-8663-674BE39C23F0}.Release|Any CPU.Build.0 = Release|Any CPU
{7E83C764-C822-4B8C-A690-E529CC9A1739}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7E83C764-C822-4B8C-A690-E529CC9A1739}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7E83C764-C822-4B8C-A690-E529CC9A1739}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7E83C764-C822-4B8C-A690-E529CC9A1739}.Release|Any CPU.Build.0 = Release|Any CPU
{1BFFAE3E-8FA1-4DF9-B46F-08C94A88BC7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1BFFAE3E-8FA1-4DF9-B46F-08C94A88BC7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1BFFAE3E-8FA1-4DF9-B46F-08C94A88BC7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -549,6 +555,7 @@ Global
{20F38722-4638-48FE-904B-4F6A8F4F362A} = {90030E85-0C4F-456F-B879-443E8A3F220D}
{A76DFCA4-4CCA-41CB-88C6-AF83414C7122} = {F23AC6C2-DE44-4699-999D-3C478EF3D691}
{F889E955-77A9-44FA-8663-674BE39C23F0} = {F23AC6C2-DE44-4699-999D-3C478EF3D691}
{7E83C764-C822-4B8C-A690-E529CC9A1739} = {90030E85-0C4F-456F-B879-443E8A3F220D}
{1BFFAE3E-8FA1-4DF9-B46F-08C94A88BC7E} = {90030E85-0C4F-456F-B879-443E8A3F220D}
{EC006198-8769-4661-9335-883EF13E6672} = {90030E85-0C4F-456F-B879-443E8A3F220D}
{065785D6-758D-4DB8-8B5B-B88B760A76DE} = {F23AC6C2-DE44-4699-999D-3C478EF3D691}
Expand Down
10 changes: 10 additions & 0 deletions src/Orchard.Cms.Web/Modules/Orchard.Logging/Module.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Name: Logging
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
Version: 2.0.x
OrchardVersion: 2.0
Description: Adds extra logging framework services.
FeatureDescription: Configurable logging sevice trough NLog.config file.
Dependencies:
Category: Logging
21 changes: 21 additions & 0 deletions src/Orchard.Cms.Web/Modules/Orchard.Logging/Orchard.Logging.xproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>

<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>7e83c764-c822-4b8c-a690-e529cc9a1739</ProjectGuid>
<RootNamespace>Orchard.Logging</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
</PropertyGroup>

<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Orchard.Logging")]
[assembly: AssemblyTrademark("")]

// 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("7e83c764-c822-4b8c-a690-e529cc9a1739")]
30 changes: 30 additions & 0 deletions src/Orchard.Cms.Web/Modules/Orchard.Logging/Startup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc.Modules;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
using NLog.Extensions.Logging;
using Microsoft.Extensions.Logging;

namespace Orchard.Users
{
public class Startup : StartupBase
{
private readonly ILoggerFactory _loggerFactory;

public Startup(ILoggerFactory loggerFactory)
{
_loggerFactory = loggerFactory;
}

public override void Configure(IApplicationBuilder builder, IRouteBuilder routes, IServiceProvider serviceProvider)
{
_loggerFactory.AddNLog();
}

public override void ConfigureServices(IServiceCollection services)
{

}
}
}
26 changes: 26 additions & 0 deletions src/Orchard.Cms.Web/Modules/Orchard.Logging/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"dependencies": {
"Microsoft.Extensions.DependencyInjection": "1.0.0",
"Microsoft.AspNetCore.Identity": "1.0.0",
"NLog.Extensions.Logging": "1.0.0-*",
"Microsoft.AspNetCore.Routing": "1.0.0",
"Microsoft.AspNetCore.Mvc.Modules.Abstractions": "1.0.0-*"
},
"buildOptions": {
"debugType": "portable"
},
"frameworks": {
"netstandard1.6": {
"imports": [
"dnxcore50",
"portable-net451+win8"
],
"dependencies": {
"NETStandard.Library": "1.6.0-*"
}
}
},
"tools": {
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-*"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"Orchard.Tokens",
"Orchard.Tokens.Content",
"Orchard.Deployment",
"Orchard.Logging",
"Orchard.Deployment.Remote",
"Orchard.Modules",
"Orchard.Recipes",
Expand Down
21 changes: 21 additions & 0 deletions src/Orchard.Cms.Web/NLog.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
internalLogLevel="Warn"
internalLogFile="App_Data\Logs\internal-nlog.txt">

<!-- define various log targets -->
<targets>
<!-- write logs to file -->
<target xsi:type="File" name="allfile" fileName="App_Data\Logs\orchard-log-${shortdate}.log"
layout="${longdate}|${event-properties:item=EventId.Id}|${logger}|${uppercase:${level}}|${message} ${exception}" />

<!--<target xsi:type="Null" name="blackhole" /> -->
</targets>

<rules>
<!--All logs-->
<logger name="*" minlevel="Warn" writeTo="allfile" />
</rules>
</nlog>
3 changes: 2 additions & 1 deletion src/Orchard.Cms.Web/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@
"views",
"_ViewStart.cshtml",
"wwwroot",
"web.config"
"web.config",
"nlog.config"
],
"exclude": [
"**/obj"
Expand Down

0 comments on commit b1701fd

Please sign in to comment.