-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: How to configure nhibernate and log4net?
PostPosted: Thu Feb 02, 2006 2:25 pm 
Newbie

Joined: Thu Feb 02, 2006 2:01 pm
Posts: 3
Hibernate version:101
Hi,
I am trying to configure nhibernate and log4net in the same config file.
However I am getting the following exception when I make the configure call.
System.TypeInitializationException occurred
Message="The type initializer for 'AppFramework.DataAccess.Tests.Setup' threw an exception."
Source="AppFramework.DataAccess.Tests"
TypeName="AppFramework.DataAccess.Tests.Setup"
StackTrace:
at AppFramework.DataAccess.Tests.Setup.get_DataContextFactory()
at AppFramework.DataAccess.Tests.BaseTest.get_DataContextFactory() in C:\AppFramework\DataAccess\Test\BaseTest.cs:line 48


Before I go to initialize the session factory I call

_configuration = new NHibernate.Cfg.Configuration().Configure(
Assembly.GetExecutingAssembly(),
string.Format("{0}.Hibernate.config", Assembly.GetExecutingAssembly().GetName().Name));

Here is my config file.

<?xml version="1.0" encoding="utf-8" ?>
<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>
<!-- properties -->
<add
key="hibernate.connection.provider"
value="NHibernate.Connection.DriverConnectionProvider"
/>
<add
key="connection.driver_class"
value="Intuit.SBM.AppFramework.DataAccess.SybaseClientDriver,Intuit.SBM.AppFramework.DataAccess"
/>
<add
key="connection.isolation"
value="ReadCommitted"
/>
<add
key="show_sql"
value="true"
/>
<add
key="dialect"
value="NHibernate.Dialect.SybaseDialect"
/>
<add
key="use_outer_join"
value="true"
/>
<add
key="command_timeout"
value="444"
/>
<add
key="query.substitutions"
value="true 1, false 0, yes 1, no 0"
/>
<add
key="prepare_sql"
value="false"
/>

</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 - %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 - %m%n" />
</layout>
</appender>

<appender name="rollingFile" type="log4net.Appender.RollingFileAppender,log4net" >

<param name="File" value="nhibernate.log" />
<param name="AppendToFile" value="false" />
<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 - %m%n" />
</layout>
</appender>

<!-- Setup the root category, add the appenders and set the default priority -->

<root>
<priority value="INFO" />
<appender-ref ref="trace" />
</root>

<logger name="NHibernate.Cache">
<level value="DEBUG" />
</logger>

<logger name="NHibernate.Impl.BatcherImpl">
<level value="WARN" />
</logger>

<logger name="NHibernate.SQL">
<level value="rollingFile" />
</logger>
</log4net>


</configuration>




I am not sure what I have wrong. I have looked through all the documentation and many of the posts and don't see anything wrong. If anyone has an idea what my problem is, I'd appreciate the help.


Thanks


Bruce


Top
 Profile  
 
 Post subject: Re: How to configure nhibernate and log4net?
PostPosted: Fri Feb 03, 2006 3:30 am 
Expert
Expert

Joined: Thu Jan 19, 2006 4:29 pm
Posts: 348
brewsterw wrote:
Hibernate version:101
System.TypeInitializationException occurred
Message="The type initializer for 'AppFramework.DataAccess.Tests.Setup' threw an exception."


It would be helpful to know what was the exception thrown by AppFramework.DataAccess.Tests.Setup intializer

Gert


Top
 Profile  
 
 Post subject: LEVEL
PostPosted: Fri Feb 03, 2006 3:36 am 
Regular
Regular

Joined: Tue Jan 03, 2006 7:21 am
Posts: 85
Why is the level for NHibernate.SQL logger defined as rollingFile. rollingFile is an appender right? Should not level be one of WARN, DEBUG etc...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.