From d08b91c9aac9f6a291394e0c25f7aad70a288ddf Mon Sep 17 00:00:00 2001 From: tmont Date: Tue, 1 Mar 2011 07:13:57 +0000 Subject: [PATCH] made logging configurable via web.config --- .../VideoGameQuotes.Api.csproj | 3 --- .../Configuration/EnableLogging.cs | 17 +++++++++++++++++ .../Configuration/EnableSearchWithLucene.cs | 1 - Src/VideoGameQuotes.Web/Global.asax.cs | 11 +---------- .../VideoGameQuotes.Web.csproj | 5 +++++ Src/VideoGameQuotes.Web/Web.config | 16 ++++++++++++++-- 6 files changed, 37 insertions(+), 16 deletions(-) create mode 100644 Src/VideoGameQuotes.Web/Configuration/EnableLogging.cs diff --git a/Src/VideoGameQuotes.Api/VideoGameQuotes.Api.csproj b/Src/VideoGameQuotes.Api/VideoGameQuotes.Api.csproj index 7f7d76d..9ed836c 100644 --- a/Src/VideoGameQuotes.Api/VideoGameQuotes.Api.csproj +++ b/Src/VideoGameQuotes.Api/VideoGameQuotes.Api.csproj @@ -46,9 +46,6 @@ ..\..\Lib\NHibernate.ByteCode.LinFu.dll - - ..\..\Lib\NHibernate.Linq.dll - ..\..\Lib\Portoa.dll diff --git a/Src/VideoGameQuotes.Web/Configuration/EnableLogging.cs b/Src/VideoGameQuotes.Web/Configuration/EnableLogging.cs new file mode 100644 index 0000000..cf0191c --- /dev/null +++ b/Src/VideoGameQuotes.Web/Configuration/EnableLogging.cs @@ -0,0 +1,17 @@ +using Microsoft.Practices.Unity; +using Portoa.Web.Unity; + +namespace VideoGameQuotes.Web.Configuration { + /// + /// Enables application-wide logging using log4net + /// + public class EnableLogging : UnityContainerExtension { + protected override void Initialize() { + Container + .AddNewExtension() + .Configure() + .SetName("vgquotes") + .UseXml(); + } + } +} \ No newline at end of file diff --git a/Src/VideoGameQuotes.Web/Configuration/EnableSearchWithLucene.cs b/Src/VideoGameQuotes.Web/Configuration/EnableSearchWithLucene.cs index 399d96d..7f8ac58 100644 --- a/Src/VideoGameQuotes.Web/Configuration/EnableSearchWithLucene.cs +++ b/Src/VideoGameQuotes.Web/Configuration/EnableSearchWithLucene.cs @@ -20,7 +20,6 @@ using Directory = Lucene.Net.Store.Directory; using Version = Lucene.Net.Util.Version; namespace VideoGameQuotes.Web.Configuration { - public class EnableSearchWithLucene : UnityContainerExtension { protected override void Initialize() { var indexWriterLifetimeManager = new ExplicitlyDisposableLifetimeManager( diff --git a/Src/VideoGameQuotes.Web/Global.asax.cs b/Src/VideoGameQuotes.Web/Global.asax.cs index 3ab4f56..1a570e0 100644 --- a/Src/VideoGameQuotes.Web/Global.asax.cs +++ b/Src/VideoGameQuotes.Web/Global.asax.cs @@ -10,7 +10,6 @@ using Portoa.Web.Unity; using UnityGenerics; using VideoGameQuotes.Api; using VideoGameQuotes.Api.Persistence; -using VideoGameQuotes.Web.Configuration; using VideoGameQuotes.Web.Controllers; using VideoGameQuotes.Web.Models; using VideoGameQuotes.Web.Security; @@ -26,12 +25,6 @@ namespace VideoGameQuotes.Web { } protected override void ConfigureUnity() { - Container - .AddNewExtension() - .Configure() - .SetName("VideoGameQuotes.Web") - .UseXml(); - Container .RegisterType(new InjectionProperty(attr => attr.UserProvider)) .RegisterAndIntercept, SessionBasedUserProvider>() @@ -44,9 +37,7 @@ namespace VideoGameQuotes.Web { .RegisterAndIntercept() .RegisterAndIntercept() .RegisterAndIntercept() - .RegisterAndIntercept() - .AddNewExtension() - .AddNewExtension(); + .RegisterAndIntercept(); } protected override void AfterStartUp() { diff --git a/Src/VideoGameQuotes.Web/VideoGameQuotes.Web.csproj b/Src/VideoGameQuotes.Web/VideoGameQuotes.Web.csproj index 08cb2c3..2c39bda 100644 --- a/Src/VideoGameQuotes.Web/VideoGameQuotes.Web.csproj +++ b/Src/VideoGameQuotes.Web/VideoGameQuotes.Web.csproj @@ -44,6 +44,10 @@ False ..\..\Lib\Microsoft.Practices.Unity.Interception.dll + + False + ..\..\Lib\NHibernate.ByteCode.LinFu.dll + False ..\..\Lib\Portoa.dll @@ -85,6 +89,7 @@ + diff --git a/Src/VideoGameQuotes.Web/Web.config b/Src/VideoGameQuotes.Web/Web.config index 9ed3306..11d9b87 100644 --- a/Src/VideoGameQuotes.Web/Web.config +++ b/Src/VideoGameQuotes.Web/Web.config @@ -2,11 +2,23 @@ - +
+ + + + + + + + + + + + @@ -25,7 +37,7 @@ - +