i Tried it, but it will not work: I try to explain my Steps:
First create new file "app.config"
Code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"/>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
</configSections>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<!--<property name="connection.connection_string">Server=(local);Database=studio;Uid=studio;Pwd=;</property>-->
<property name="show_sql">false</property>
<mapping assembly="Studio.Database.NHibernate"/>
</session-factory>
</hibernate-configuration>
<log4net debug="false">
<appender name="TraceAppender" type="log4net.Appender.TraceAppender, log4net">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%-5level %M - %message%newline" />
</layout>
</appender>
<root>
<level value="OFF" />
<appender-ref ref="TraceAppender"/>
</root>
<logger name="NHibernate">
<level value="OFF"/>
</logger>
<logger name="Logger">
<level value="OFF"/>
<appender-ref ref="TraceAppender" />
</logger>
<logger name="NHibernate.Loader.Entity.AbstractEntityLoader">
<level value="OFF"/>
<appender-ref ref="TraceAppender"/>
</logger>
</log4net>
</configuration>
Than i set "Build Action" = Embedded Ressource
Than i edit my Programm.cs
Code:
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
log4net.Config.XmlConfigurator.Configure();
Application.Run(new Form1());
}
Than i called the Configuration File:
Code:
private Configuration _Configuration = new Configuration().Configure();
But the Logging will not work! What shut i change? And where can i generally see the logging? i prefared it, if log4net will create a txt.file....
teLLy