c# - log4net logging not creating log file -


i'm not sure if right forum post question. i'm hoping here might have used log4net in past, hoping help.

i'm using log4net log exceptions. configuration settings this:

<?xml version="1.0" encoding="utf-8" ?> <configuration>  <configsections>   <section name="log4net" type="log4net.config.log4netconfigurationsectionhandler, log4net"/>  </configsections>  <log4net debug="false">   <appender name="rollinglogfileappender" type="log4net.appender.rollingfileappender">    <file value="c:\logs\sample.log" />    <appendtofile value="true"/>    <rollingstyle value="size"/>    <maxsizerollbackups value="10"/>    <maximumfilesize value="10mb"/>    <staticlogfilename value="true"/>    <layout type="log4net.layout.patternlayout">      <conversionpattern value="%-5level %date %logger.%method[line %line] - %message%newline"/>    </layout>  </appender>  <root>   <level value="info"/>   <appender-ref ref="rollinglogfileappender"/>  </root> </log4net> </configuration> 

i started out adding configuration web.config, got error (vs studio not find schema log4net-"could not find schema information element log4net"). followed link (log4net "could not find schema information" messages) , configured settings in separate xml file , added following line of code in assemblyinfo.cs:

[assembly: log4net.config.xmlconfigurator(configfile = "xmlfile.xml", watch = true)] 

and in actual code, placed line:

public void createuser(string username, string password) {  try  {   log.info("inside createuser");   //code creating user  }  catch(exception e)  {   log.info("something happened in create user", e);  } } 

the problem log file not being created. can't see inside c:\logs. can tell me i'm doing wrong here?

any suggestions/inputs helpful.

thank in advance.

i not setting in asembly.cs work without adding application_start in global.asax:

log4net.config.xmlconfigurator.configure(); 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -