log4net in asp.net with LogFileAppender

Discussion in 'ASP .Net' started by Gawel, Jan 24, 2005.

  1. Gawel

    Gawel Guest

    hajo,
    can someone send me an example how to use above pattern
    in asp.net applicaiton? I can not figure out how to do it.
    I get no exceptions, simply no logging occures.


    Thanks for any info


    Gawel
    Gawel, Jan 24, 2005
    #1
    1. Advertising

  2. Patrick Steele [MVP], Jan 25, 2005
    #2
    1. Advertising

  3. Gawel

    Gawel Guest

    Patrick Steele [MVP] wrote:
    > In article <uSIJ$>,
    > gawelek@SPAM_NO_NON_NOgazeta.pl says...
    >
    >>hajo,
    >>can someone send me an example how to use above pattern
    >>in asp.net applicaiton? I can not figure out how to do it.
    >>I get no exceptions, simply no logging occures.

    >
    >
    > Do you mean the EventLogAppender? See:
    >
    > http://logging.apache.org/log4net/release/manual/faq.html#HC-33307780

    Hajo, I know this FAQ and I changed the security for this account
    but I still can not get it working. Therefore I need an example
    step by step.


    Thanks for your effort

    Gawel
    Gawel, Jan 25, 2005
    #3
  4. Gawel

    Gawel Guest

    Patrick Steele [MVP] wrote:

    > In article <uSIJ$>,
    > gawelek@SPAM_NO_NON_NOgazeta.pl says...
    >
    >>hajo,
    >>can someone send me an example how to use above pattern
    >>in asp.net applicaiton? I can not figure out how to do it.
    >>I get no exceptions, simply no logging occures.

    >
    >
    > Do you mean the EventLogAppender? See:
    >
    > http://logging.apache.org/log4net/release/manual/faq.html#HC-33307780

    Ok , I found the solution of the problem.
    I forgot to add [assembly: log4net.Config.DOMConfigurator(Watch=true)]
    to my assemblyinfo.cs file.

    Gawel
    Gawel, Jan 25, 2005
    #4
  5. Gawel

    Matt Berther Guest

    Hello Gawel,

    I, too, had a problem getting this working properly... This is what I ended
    up doing...

    1. Modify the web.config file by adding this configSection:

    <configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,
    log4net"/>
    </configSections>

    2. Then add this configuration section:

    <log4net>
    <root>
    <level value="OFF" />
    <appender-ref ref="FileAppender" />
    </root>

    <appender name="FileAppender" type="log4net.Appender.FileAppender">
    <file value="log-file.txt"/>
    <appendToFile value="true"/>

    <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%d [%t] %-5p %c [%x] &lt;%X{auth}> - %m%n" />
    </layout>
    </appender>
    </log4net>

    3. Now, the key part that put everything together... In Application_Start,
    put this line:
    log4net.Config.DOMConfigurator.Configure(); // this loads the config information
    from the web.config file

    4. Add logging to your classes, according to the samples at the log4net website.


    --
    Matt Berther
    http://www.mattberther.com

    > Patrick Steele [MVP] wrote:
    >
    >> In article <uSIJ$>,
    >> gawelek@SPAM_NO_NON_NOgazeta.pl says...
    >>
    >>> hajo,
    >>> can someone send me an example how to use above pattern
    >>> in asp.net applicaiton? I can not figure out how to do it.
    >>> I get no exceptions, simply no logging occures.

    >> Do you mean the EventLogAppender? See:
    >>
    >> http://logging.apache.org/log4net/release/manual/faq.html#HC-33307780
    >>

    > Hajo, I know this FAQ and I changed the security for this account but
    > I still can not get it working. Therefore I need an example step by
    > step.
    >
    > Thanks for your effort
    >
    > Gawel
    >
    Matt Berther, Jan 25, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Raj Dhrolia

    Log4Net help wanted

    Raj Dhrolia, Dec 22, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    580
    Raj Dhrolia
    Dec 22, 2003
  2. Ram

    Using Log4Net From 2 Process

    Ram, Jul 22, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,968
    Martin Higgins
    Jul 27, 2004
  3. wolfgang wagner

    log4net ans dotnet 2.0

    wolfgang wagner, Mar 21, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    433
  4. Mr Flibble
    Replies:
    0
    Views:
    479
    Mr Flibble
    Jun 30, 2006
  5. Marc Scheuner
    Replies:
    2
    Views:
    736
    Marc Scheuner
    Sep 4, 2006
Loading...

Share This Page