ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ling Wang <lingwan...@yahoo.com>
Subject Re: Debug SQL Statement, Log4net help needed
Date Mon, 12 Sep 2005 19:12:42 GMT
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>
  <logger
name="IBatisNet.DataMapper.Commands.IPreparedCommand">
   <level value="OFF" />
  </logger>  
 </log4net>


</configuration>


Thanks.

Ling

--- Zarar Siddiqi <zarars@softbloc.com> wrote:

> For what it's worth to you, here is what I have and
> it's working fine:
> 
> AssemblyInfo.cs:
> 
> [assembly:
> log4net.Config.DOMConfigurator(Watch=true)]
> 
> Web.config (log.txt is created in the base project
> directory):
> 
>  <!-- Register a section handler for the log4net
> section -->
>  <configSections>
>   <section name="log4net"
>
type="log4net.Config.Log4NetConfigurationSectionHandler,
> log4net" />
>  </configSections>
> 
>  <!-- 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="200KB" />
>    <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>
> 
>   <root>
>    <level value="INFO" />
>    <appender-ref ref="RollingLogFileAppender" />
>   </root>
> 
>   <logger
>
name="IBatisNet.DataMapper.Configuration.Statements.DefaultPreparedCommand">
>    <level value="ALL" />
>   </logger>
>  </log4net>
> 
> 
> 
> 
> >  -------Original Message-------
> >  From: Ling Wang <lingwang_x@yahoo.com>
> >  Subject: Debug SQL Statement, Log4net help needed
> >  Sent: 12 Sep '05 09:43
> >  
> >  Hi there,
> >  
> >  I ran NPetShop out of box and got an sql
> exception
> >  "Data type mismatch in criteria" when I tried to
> >  register a new user (I did not create any new
> code,
> >  the original code uses "InsertProfile"). I would
> like
> >  to see the sql statement. I searched the mail
> archive
> >  and found a suggestion using
> >  GetMappedStatement("InsertProfile"). I tried and
> got
> >  an message:
> >  
> >  MappedStatement: InsertProfile
> >  InsertProfile-InLineParameterMap
> >  
> >  which is not I am looking for.
> >  
> >  I then tried to configure log4net following the
> >  documentation. Hoping to get the SQL statement
> that
> >  way. I tried almost everything including adding
> >  log4net config info to  the web.config or using
> its
> >  own config file by setting or withoug setting:
> >  
> >  [assembly: log4net.Config.DOMConfigurator(
> >  ConfigFile="NPetshop.Web.dll.config",Watch=true
> )]
> >  
> >  I still did not see any log.txt file.
> >  
> >  Can anyone help me out?
> >  
> >  Thanks.
> >  
> >  Ling
> >  
> 


Mime
View raw message