Package Install
Nuget Package Manager > log4net > Install
Solution Explorer > Properties > AssemblyInfo.cs
[assembly: log4net.Config.XmlConfigurator(Watch = true)] |
Web.config
<configSections> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" /> <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections> <connectionStrings>
<log4net> <appender name="RollingFile" type="log4net.Appender.RollingFileAppender"> <file value="App_Data/logs/log.txt" /> <appendToFile value="true" /> <datePattern value="-yyyy-MM-dd" /> <rollingStyle value="Date" /> <param name="ImmediateFlush" value="true" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%d [%t] %-5p %c - %m%n" /> </layout> </appender> <appender name="DebugAppender" type="log4net.Appender.DebugAppender"> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%d [%t] %-5p %c - %m%n" /> </layout> </appender> <root> <level value="DEBUG" /> <appender-ref ref="DebugAppender" /> <appender-ref ref="RollingFile" /> </root> </log4net> |
소스 적용
예) Solution Explorer > Controllers > OOOController.cs
'Web_Application > ASP.NET MVC' 카테고리의 다른 글
asp.net mvc ajax post 500 error (0) | 2017.02.07 |
---|---|
bundle 403 error (0) | 2017.02.03 |
[ASP.NET MVC] Make sure that the controller has a parameterless public constructor (0) | 2017.01.12 |
Error 1053: "The service did not respond in a timely fashion" when attempting to start, stop or pause a service (0) | 2016.12.29 |
Upgrading mvc4 to mvc5 in vs2013 (0) | 2016.12.17 |