Have you tried following these instructions?

 http://logging.apache.org/log4net/release/faq.html#internalDebug

and verified that log4net is starting correctly? Maybe log4net can't
find its config file. I would also try using an appender that does not
require file access to verify that log4net has been configured
correctly:

<appender name="AspNetTraceAppender"
type="log4net.Appender.AspNetTraceAppender" >
<layout type="log4net.Layout.PatternLayout" />
</appender>

Once that is working you can concentrate on the FileAppender.

--- Ken Chu <[EMAIL PROTECTED]> wrote:

> Hi .Net developers,
> 
> I've been trying to get the log4net 1.2.9 beta's WebApp example to
> work under
> ASP.NET 2.0 without any luck (using C# in VS2005).  I don't get any
> log files
> nor trace output when I go to http://myhost/WebAppCS/Trace.axd.  Here
> are the
> things I've tried to do:
> 
> - make sure the directory for the log file is writable
> - setting the output log file with absolute path
> (c:\tmp\webapp-log.txt)
> - change '\' to '\\' in the WebApp.dll.log4net file
> - copy the content of WebApp.dll.log4net into Web.config
> - turn on log4net internal debug flag (where does this output to?)
> 
> Could someone tell me what I'm missing?  Why isn't the WebForm1.asp
> page
> producing a log file or trace output?  Is this because I converted
> this .NET
> 1.0 project to .NET 2.0?
> 
> Below is my current web.config file.  Any help would be appreciated.
> 
> -Ken
> ---------------------------------------------------
> <?xml version="1.0"?>
> <configuration>
>     <configSections>
>         <section name="log4net"
> type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
>     </configSections>
>       <appSettings>
>               <!-- To enable internal log4net logging specify the 
>                    following appSettings key -->
>               <add key="log4net.Internal.Debug" value="true"/>
>     </appSettings>
>       <system.web>
>               <!--  DYNAMIC DEBUG COMPILATION
>           Set compilation debug="true" to enable ASPX debugging. 
> Otherwise,
> setting this value to
>           false will improve runtime performance of this application.
> 
>           Set compilation debug="true" to insert debugging symbols
> (.pdb
> information)
>           into the compiled page. Because this creates a larger file
> that
> executes
>           more slowly, you should set this value to true only when
> debugging
> and to
>           false at all other times. For more information, refer to
> the
> documentation about
>           debugging ASP .NET files.
>     -->
>               <compilation defaultLanguage="c#" debug="true">
>                         <!-- below doesn't work in .NET 2.0.
>                           <compilers>
>                               <compiler language="c#"
> type="Microsoft.CSharp.CSharpCodeProvider, System,
> Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"
> extension=".cs" compilerOptions="/d:DEBUG;TRACE"/>
>                           </compilers> -->
>         </compilation>
>               <!--  CUSTOM ERROR MESSAGES
>           Set customError mode values to control the display of
> user-friendly 
>           error messages to users instead of error details (including
> a stack
> trace):
> 
>           "On" Always display custom (friendly) messages  
>           "Off" Always display detailed ASP.NET error information.
>           "RemoteOnly" Display custom (friendly) messages only to
> users not
> running 
>           on the local Web server. This setting is recommended for
> security
> purposes, so 
>           that you do not display application detail information to
> remote
> clients.
>     -->
>               <customErrors mode="RemoteOnly"/>
>               <!--  AUTHENTICATION 
>           This section sets the authentication policies of the
> application.
> Possible modes are "Windows", "Forms", 
>           "Passport" and "None"
>     -->
>               <!-- authentication mode="Windows" / -->
>               <!--  APPLICATION-LEVEL TRACE LOGGING
>           Application-level tracing enables trace log output for
> every page
> within an application. 
>           Set trace enabled="true" to enable application trace
> logging.  If
> pageOutput="true", the
>           trace information will be displayed at the bottom of each
> page. 
> Otherwise, you can view the 
>           application trace log by browsing the "trace.axd" page from
> your web
> application
>           root. 
>     -->
>               <trace enabled="true" requestLimit="20" pageOutput="false"
> traceMode="SortByTime" localOnly="true"/>
>               <!--  SESSION STATE SETTINGS
>           By default ASP .NET uses cookies to identify which requests
> belong to
> a particular session. 
>           If cookies are not available, a session can be tracked by
> adding a
> session identifier to the URL. 
>           To disable cookies, set sessionState cookieless="true".
>     -->
>               <!--sessionState 
>             mode="InProc"
>             stateConnectionString="tcpip=127.0.0.1:42424"
>             sqlConnectionString="data source=127.0.0.1;user
> id=sa;password="
>             cookieless="false" 
>             timeout="20" 
>     /-->
>               <!--  GLOBALIZATION
>           This section sets the globalization settings of the
> application. 
>     -->
>               <globalization requestEncoding="utf-8" 
> responseEncoding="utf-8"/>
>               <xhtmlConformance mode="Legacy"/>
>     </system.web>
>     
>     <log4net debug="false">
>         <appender name="LogFileAppender"
> type="log4net.Appender.FileAppender" >
>             <file value="C:\tmp\webapp-log.txt" />
>             <appendToFile value="true" />
>             <layout type="log4net.Layout.PatternLayout">
>                 <conversionPattern value="%date [%thread] %-5level
> %logger
> [%ndc] - %message%newline" />
>             </layout>
>         </appender>
>         <appender name="HttpTraceAppender"
> type="log4net.Appender.AspNetTraceAppender" >
>             <layout type="log4net.Layout.PatternLayout">
>                 <conversionPattern value="%date [%thread] %-5level
> %logger
> [%ndc] - %message%newline" />
>             </layout>
>         </appender>
>         <appender name="RollingLogFileAppender"
> type="log4net.Appender.RollingFileAppender">
>             <file value="\\tmp\\rolling-log.txt" />
>             <appendToFile value="true" />
>             <maxSizeRollBackups value="10" />
>             <maximumFileSize value="5MB" />
>             <rollingStyle value="Size" />
>             <staticLogFileName value="true" />
>             <layout type="log4net.Layout.PatternLayout">
>                 <conversionPattern value="%date [%thread] %-5level
> %logger
> [%ndc] - %message%newline" />
>             </layout>
>         </appender>
>         <root>
>             <level value="ALL" />
>             <appender-ref ref="LogFileAppender" />
>             <appender-ref ref="HttpTraceAppender" />
>             <appender-ref ref="RollingLogFileAppender" />
>         </root>
>     </log4net>
> </configuration>
> 

Reply via email to