enabling log4net
-
I'm using log4net in my app to print debugging information. I have added code as follows static QuestionGroup() { log = log4net.LogManager.GetLogger(typeof(QuestionGroup)); isDebugEnabled = log.IsDebugEnabled; isInfoEnabled = log.IsInfoEnabled; } public QuestionGroup() { questionGroupId="questionGroup"+questionGroupCreated++; heading="Place your heading here"; subHeading="Place your subheading here"; position=-1; this.questionList=new ArrayList(); if(isDebugEnabled) { log.Debug("QuestionGroup created with id :"+questionGroupId); } } but in the output window it give the error log4net:ERROR No appender named [LogFileAppender] could be found. how can I fix it samitha
-
I'm using log4net in my app to print debugging information. I have added code as follows static QuestionGroup() { log = log4net.LogManager.GetLogger(typeof(QuestionGroup)); isDebugEnabled = log.IsDebugEnabled; isInfoEnabled = log.IsInfoEnabled; } public QuestionGroup() { questionGroupId="questionGroup"+questionGroupCreated++; heading="Place your heading here"; subHeading="Place your subheading here"; position=-1; this.questionList=new ArrayList(); if(isDebugEnabled) { log.Debug("QuestionGroup created with id :"+questionGroupId); } } but in the output window it give the error log4net:ERROR No appender named [LogFileAppender] could be found. how can I fix it samitha
I have just started to use log4net too in my shareware and I think its a great little tool. I think you need to look at your config file and clean it up abit and have only the things in there that you want/need. In mine I have a section named LogFileAppender, here it that section of my config (had to add spaces to get the xml to show up correctly):
< appender name="LogFileAppender" type="log4net.Appender.FileAppender">
< param name="File" value="log-file.txt" />
< param name="AppendToFile" value="true" />
< layout type="log4net.Layout.PatternLayout">
< param name="Header" value="[Header]\r\n" />
< param name="Footer" value="[Footer]\r\n" />
< param name="ConversionPattern" value="%d [%t] %-5p %c [%x] <%X{auth}> - %m%n" />
< /layout>
< /appender>Steve Maier, MCSD MCAD
-
I have just started to use log4net too in my shareware and I think its a great little tool. I think you need to look at your config file and clean it up abit and have only the things in there that you want/need. In mine I have a section named LogFileAppender, here it that section of my config (had to add spaces to get the xml to show up correctly):
< appender name="LogFileAppender" type="log4net.Appender.FileAppender">
< param name="File" value="log-file.txt" />
< param name="AppendToFile" value="true" />
< layout type="log4net.Layout.PatternLayout">
< param name="Header" value="[Header]\r\n" />
< param name="Footer" value="[Footer]\r\n" />
< param name="ConversionPattern" value="%d [%t] %-5p %c [%x] <%X{auth}> - %m%n" />
< /layout>
< /appender>Steve Maier, MCSD MCAD
I'm getting the following messages log4net:ERROR No appender named [LogFileAppender] could be found. log4net: Appender named [LogFileAppender] not found. log4net:ERROR No appenders could be found for category (Com.SriLogic.Qsurv.QBuilder.Gui.MainForm). log4net:ERROR Please initialize the log4net system properly. here is the config file /**/ /**/ how can I fix this? samitha
-
I'm getting the following messages log4net:ERROR No appender named [LogFileAppender] could be found. log4net: Appender named [LogFileAppender] not found. log4net:ERROR No appenders could be found for category (Com.SriLogic.Qsurv.QBuilder.Gui.MainForm). log4net:ERROR Please initialize the log4net system properly. here is the config file /**/ /**/ how can I fix this? samitha
In my file I have my "logger" section defined at the end of the file under my "root" section. I think that yours might need to move down because it does not know the definition of the LogFileAppender before its defined. I can email you my file if you want too. Steve Maier, MCSD MCAD