First of all in ASP.NET projects you can use ONLY the web.config file for configuring your web app.
The web.config file I currently use looks like this:
Code:
<configuration>
<configSections>
<section name="nhibernate" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
</configSections>
<nhibernate>
<add
key="hibernate.connection.provider"
value="NHibernate.Connection.DriverConnectionProvider"/>
<add
key="hibernate.dialect"
value="NHibernate.Dialect.MsSql2000Dialect"/>
<add
key="hibernate.connection.driver_class"
value="NHibernate.Driver.SqlClientDriver"/>
<add
key="hibernate.connection.connection_string"
value="Server=(local);initial catalog=DataBaseName;User ID=username;Password=password;Min Pool Size=2"/>
</nhibernate>
<!-- This section contains the log4net configuration settings -->
<log4net debug="false">
<!-- Define some output appenders -->
<appender name="trace" type="log4net.Appender.TraceAppender, log4net">
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] <%X{auth}> - %m%n" />
</layout>
</appender>
<appender name="console" type="log4net.Appender.ConsoleAppender, log4net">
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] <%X{auth}> - %m%n" />
</layout>
</appender>
<appender name="rollingFile" type="log4net.Appender.RollingFileAppender,log4net" >
<param name="File" value="log.txt" />
<param name="AppendToFile" value="true" />
<param name="RollingStyle" value="Date" />
<param name="DatePattern" value="yyyy.MM.dd" />
<param name="StaticLogFileName" value="true" />
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] <%X{auth}> - %m%n" />
</layout>
</appender>
<!-- Setup the root category, add the appenders and set the default priority -->
<root>
<priority value="ERROR" />
<appender-ref ref="rollingFile" />
</root>
<logger name="NHibernate.Impl.BatcherImpl">
<level value="ERROR" />
</logger>
</log4net>
<!-- from here, the standard web.config content-->
</configuration>
So basically you have to add the <configSections> tag which declare the handlers for the <log4net> and <nhibernate> tags, then you put the log4net and nhibernate tags. Do a search for log4net you will find plenty of docs about how to set it up. Still you have to clarify what do you mean by "log4net is not working"? You havn't got any entries in the logs? You have to keeep in mind that there are issues with using a file appender in ASP.NET apps, by default the ASP.NET worker process does not have enough credentials to write on your disk. Usually you have to grant to the ASPNET user the right to write on the directory where your web app resides. Anyway you should get log entries in your VS.NET console if you have declared a console appender. Again I advise you to do a google for log4net and ASP.NET. Here some links I've found useful:
http://tom.gilki.org/programming/net/120604/
http://weblogs.asp.net/dr.netjes/archive/2005/02/16/374780.aspx
http://haacked.com/archive/2005/03/07/2317.aspx
Cheers,
Radu