made logging configurable via web.config
This commit is contained in:
parent
b1056e079d
commit
d08b91c9aa
@ -46,9 +46,6 @@
|
||||
<Reference Include="NHibernate.ByteCode.LinFu">
|
||||
<HintPath>..\..\Lib\NHibernate.ByteCode.LinFu.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NHibernate.Linq">
|
||||
<HintPath>..\..\Lib\NHibernate.Linq.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Portoa">
|
||||
<HintPath>..\..\Lib\Portoa.dll</HintPath>
|
||||
</Reference>
|
||||
|
17
Src/VideoGameQuotes.Web/Configuration/EnableLogging.cs
Normal file
17
Src/VideoGameQuotes.Web/Configuration/EnableLogging.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using Microsoft.Practices.Unity;
|
||||
using Portoa.Web.Unity;
|
||||
|
||||
namespace VideoGameQuotes.Web.Configuration {
|
||||
/// <summary>
|
||||
/// Enables application-wide logging using log4net
|
||||
/// </summary>
|
||||
public class EnableLogging : UnityContainerExtension {
|
||||
protected override void Initialize() {
|
||||
Container
|
||||
.AddNewExtension<ConfigureLog4Net>()
|
||||
.Configure<ILog4NetConfigurator>()
|
||||
.SetName("vgquotes")
|
||||
.UseXml();
|
||||
}
|
||||
}
|
||||
}
|
@ -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<IndexWriter>(
|
||||
|
@ -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<ConfigureLog4Net>()
|
||||
.Configure<ILog4NetConfigurator>()
|
||||
.SetName("VideoGameQuotes.Web")
|
||||
.UseXml();
|
||||
|
||||
Container
|
||||
.RegisterType<VerifyUserAttribute>(new InjectionProperty<VerifyUserAttribute>(attr => attr.UserProvider))
|
||||
.RegisterAndIntercept<ICurrentUserProvider<User>, SessionBasedUserProvider>()
|
||||
@ -44,9 +37,7 @@ namespace VideoGameQuotes.Web {
|
||||
.RegisterAndIntercept<IGameService, GameService>()
|
||||
.RegisterAndIntercept<IApiService, ApiService>()
|
||||
.RegisterAndIntercept<IAuthenticationService, FormsAuthenticationService>()
|
||||
.RegisterAndIntercept<IUserRepository, UserRepository>()
|
||||
.AddNewExtension<LogAllMethodCalls>()
|
||||
.AddNewExtension<EnableSearchWithLucene>();
|
||||
.RegisterAndIntercept<IUserRepository, UserRepository>();
|
||||
}
|
||||
|
||||
protected override void AfterStartUp() {
|
||||
|
@ -44,6 +44,10 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\Lib\Microsoft.Practices.Unity.Interception.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NHibernate.ByteCode.LinFu, Version=3.0.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\Lib\NHibernate.ByteCode.LinFu.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Portoa, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\Lib\Portoa.dll</HintPath>
|
||||
@ -85,6 +89,7 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Configuration\EnableLogging.cs" />
|
||||
<Compile Include="Configuration\EnableSearchWithLucene.cs" />
|
||||
<Compile Include="Configuration\UpdateSearchIndexCallHandler.cs" />
|
||||
<Compile Include="Controllers\AdminController.cs" />
|
||||
|
@ -2,11 +2,23 @@
|
||||
|
||||
<configuration>
|
||||
<configSections>
|
||||
<!--<section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection"/>-->
|
||||
<section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection"/>
|
||||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
|
||||
<section name="vgquotes" type="System.Configuration.NameValueSectionHandler"/>
|
||||
</configSections>
|
||||
|
||||
<unity>
|
||||
<containers>
|
||||
<container>
|
||||
<extensions>
|
||||
<add type="VideoGameQuotes.Web.Configuration.EnableLogging, VideoGameQuotes.Web"/>
|
||||
<add type="Portoa.Web.Unity.LogAllMethodCalls, Portoa.Web"/>
|
||||
<add type="VideoGameQuotes.Web.Configuration.EnableSearchWithLucene, VideoGameQuotes.Web"/>
|
||||
</extensions>
|
||||
</container>
|
||||
</containers>
|
||||
</unity>
|
||||
|
||||
<vgquotes>
|
||||
<add key="luceneIndexDirectory" value="c:\users\tmont\code\VideoGameQuotes\lucene_index"/>
|
||||
</vgquotes>
|
||||
@ -25,7 +37,7 @@
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<logger name="VideoGameQuotes.Web">
|
||||
<logger name="vgquotes">
|
||||
<level value="ALL"/>
|
||||
<appender-ref ref="DebugAppender" />
|
||||
<appender-ref ref="TelnetAppender" />
|
||||
|
Loading…
Reference in New Issue
Block a user