KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm having some trouble getting log4net to work from ASP.NET 3.5. This is the first time I've tried to use log4net, I feel like I'm missing a piece of the puzzle. My project references the log4net assembly, and as far as I can tell, it is being deployed successfully on my server. My web.config contains the following: <configSections> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler , log4net" requirePermission="false"/> </configSections> <log4net> <appender name="InfoAppender" type="log4net.Appender.FileAppender"> <file value="..\..\logs\\InfoLog.html" /> <appendToFile value="true" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%d [%t] %-5p %c [%x] - %m%n" /> </layout> </appender> <logger name="_Default"> <level value="INFO" /> <appender-ref ref="InfoAppender" /> </logger> </log4net> I'm using the following code to test the logger: using log4net; using log4net.Config; public partial class _Default : System.Web.UI.Page { private static readonly ILog log = LogManager.GetLogger("_Default"); protected void Page_Load(object sender, EventArgs e) { log.Info("Hello logging world!"); } } In my Global.asax, I'm doing the following: void Application_Start(object sender, EventArgs e) { log4net.Config.XmlConfigurator.Configure(); } At this point, I can't think of what else I might be doing wrong. The directory I'm trying to store the log in is writable, and even if I try different directories I get the same result: no file, no logs. Any suggestions? :-) Edit: I've tried several different formats for the path & name of the log file, some of which include
Tags (comma-separated)
Save Edits
Cancel