Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. enabling log4net

enabling log4net

Scheduled Pinned Locked Moved C#
helpdebuggingquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    samithas
    wrote on last edited by
    #1

    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

    S 1 Reply Last reply
    0
    • S samithas

      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

      S Offline
      S Offline
      Steve Maier
      wrote on last edited by
      #2

      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

      S 1 Reply Last reply
      0
      • S Steve Maier

        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

        S Offline
        S Offline
        samithas
        wrote on last edited by
        #3

        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

        S 1 Reply Last reply
        0
        • S samithas

          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

          S Offline
          S Offline
          Steve Maier
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups