Ron,

I tried StreamWriter in the Application_Start. I was
able to create and write text into a text file in the
same folder as the log.txt. But log.txt is still
nowhere to be seen.

I wonder if anyone ever succeeded using log4net for
npetshop (not npetshop2).

For me, making log4net working is not as important.
The reason I want to use log4net is that I want to see
the SQL statement so I can debug. I am getting an
error fresh out of box and just could not figure out
what is wrong. I got an error saying

Error executing query 'InsertProfile' for insert.
Cause: Data type mismatch in criteria expression. 

when I was registering a new user.

I would also like to be able to do so (see the sql
statements) in the future.

Thanks.

Ling

--- Ron Grabowski <[EMAIL PROTECTED]> wrote:

> Have you tried specifying a known writable path for
> the log file:
> 
>  <param name="File"
> value="c:\\inetpub\\wwwroot\\log.txt" />
> 
> The #1 problem people have with log4net and web
> applications is that
> log4net does not have the correct permissions to
> write a file.
> 
> In your Application_Start, try creating a TextWriter
> in the same folder
> you would like to store your log files in and see if
> you get an
> exception.
> 
> --- Ling Wang <[EMAIL PROTECTED]> wrote:
> 
> > Zarar,
> > 
> > I did what you are suggesting. Still no luck
> finding
> > where log.txt is. 
> > Here is my assembly.cs file:
> > 
> > using System.Reflection;
> > using System.Runtime.CompilerServices;
> > 
> > [assembly: AssemblyTitle("NPetShop")]
> > [assembly: AssemblyDescription("Fully functional
> web
> > application based on iBATIS.NET")]
> > [assembly: AssemblyConfiguration("")]
> > [assembly: AssemblyCompany("")]
> > [assembly: AssemblyProduct("")]
> > [assembly: AssemblyCopyright("Gilles Bayon")]
> > [assembly: AssemblyTrademark("")]
> > [assembly: AssemblyCulture("")]             
> > 
> > [assembly:
> log4net.Config.DOMConfigurator(Watch=true)]
> > 
> > 
> > [assembly: AssemblyVersion("1.0.0.*")]
> > 
> > [assembly: AssemblyDelaySign(false)]
> > [assembly: AssemblyKeyFile("")]
> > [assembly: AssemblyKeyName("")]
> > 
> > and here is my web.config file:
> > 
> > 
> > <?xml version="1.0" encoding="utf-8" ?>
> > <configuration>
> > 
> > <configSections>
> >   <section name="log4net"
> >
>
type="log4net.Config.Log4NetConfigurationSectionHandler,
> > log4net" />
> >  </configSections>
> >  
> >     <appSettings>
> >        <add key="StrutsConfigFile"
> > value="nstruts-config.xml" />
> >        <add key="log4net.Internal.Debug"
> value="true"/>
> >     </appSettings>      
> >     
> >   <system.web>
> >     <compilation 
> >          defaultLanguage="c#"
> >          debug="true"
> >     />
> > 
> >     <customErrors 
> >     mode="RemoteOnly" 
> >     /> 
> > 
> >     <authentication mode="Windows" /> 
> > 
> >     <authorization>
> >         <allow users="*" /> <!-- Allow all users
> -->
> >             <!--  <allow     users="[comma
> separated
> > list of users]"
> >                              roles="[comma
> separated
> > list of roles]"/>
> >                   <deny      users="[comma
> separated
> > list of users]"
> >                              roles="[comma
> separated
> > list of roles]"/>
> >             -->
> >     </authorization>
> > 
> >     <trace
> >         enabled="false"
> >         requestLimit="10"
> >         pageOutput="false"
> >         traceMode="SortByTime"
> >             localOnly="true"
> >     />
> > 
> >     <sessionState 
> >             mode="InProc"
> >            
> > stateConnectionString="tcpip=127.0.0.1:42424"
> >             sqlConnectionString="data
> > source=127.0.0.1;Trusted_Connection=yes"
> >             cookieless="false" 
> >             timeout="20" 
> >     />
> > 
> >     <globalization 
> >             requestEncoding="utf-8" 
> >             responseEncoding="utf-8" 
> >    />
> >  </system.web>
> > 
> >  <!-- This section contains the log4net
> configuration
> > settings -->
> >  <log4net>
> >   <!-- Define some output appenders -->
> >   <appender name="RollingLogFileAppender"
> > type="log4net.Appender.RollingFileAppender">
> >    <param name="File" value="log.txt" />
> >    <param name="AppendToFile" value="true" />
> >    <param name="MaxSizeRollBackups" value="2" />
> >    <param name="MaximumFileSize" value="100KB" />
> >    <param name="RollingStyle" value="Size" />
> >    <param name="StaticLogFileName" 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] - %m%n" />
> >    </layout>
> >   </appender>
> >   <appender name="ConsoleAppender"
> > type="log4net.Appender.ConsoleAppender">
> >    <layout type="log4net.Layout.PatternLayout">
> >     <param name="ConversionPattern" value="%d [%t]
> > %-5p %c [%x] &lt;%X{auth}&gt; - %m%n" />
> >    </layout>
> >   </appender>
> > 
> >   <!-- OFF, FATAL, ERROR, WARN, INFO, DEBUG, ALL
> -->
> >   <!-- Set root logger level to ERROR and its
> > appenders -->
> >   <root>
> >    <level value="ERROR" />
> >    <appender-ref ref="RollingLogFileAppender" />
> >    <appender-ref ref="ConsoleAppender" />
> >   </root>
> > 
> >   <!-- Print only messages of level DEBUG or above
> in
> > the packages -->
> >   <logger
> >
>
name="IBatisNet.DataMapper.Commands.DefaultPreparedCommand">
> >    <level value="DEBUG" />
> >   </logger>
> >   <logger
> >
>
name="IBatisNet.DataMapper.Configuration.Cache.CacheModel">
> >    <level value="DEBUG" />
> >   </logger>
> >   <logger
> name="IBatisNet.DataMapper.LazyLoadList">
> >    <level value="DEBUG" />
> >   </logger>
> >   <logger
> name="IBatisNet.DataMapper.SqlMapSession">
> >    <level value="DEBUG" />
> >   </logger>
> >   <logger
> >
>
name="IBatisNet.Common.Transaction.TransactionScope">
> >    <level value="DEBUG" />
> >   </logger>
> >   <logger name="IBatisNet.DataAccess.DaoSession">
> >    <level value="DEBUG" />
> >   </logger>
> >   <logger
> >
> name="IBatisNet.DataAccess.Configuration.DaoProxy">
> >    <level value="DEBUG" />
> >   </logger>
> >   <logger
> >
>
name="IBatisNet.DataMapper.Configuration.Statements.PreparedStatementFactory">
> >    <level value="OFF" />
> >   </logger>
> 
=== message truncated ===

Reply via email to