Well, I guess some parts of NHibernate produce output, for debugging
purposes, using log4net, but not all.


On Jun 29, 12:51 pm, raffaeu <[email protected]> wrote:
> Ok thank you.
> In fact, if I use your configuration, in the log i see all the
> generated SQL.
> Is there a specific explanation?
>
> On Jun 29, 5:42 am, Ricardo Peres <[email protected]> wrote:
>
>
>
>
>
>
>
> > Forget the built-in SQL output functionality, you need to configure
> > log4net properly:
>
> > <configuration>
> >         <configSections>
> >                 <section name="log4net"
> > type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"
> > requirePermission="false"/>
> > ...
> >         </configSections>
> >         <log4net debug="false">
> >                 <!-- for console -->
> >                 <appender name="console" 
> > type="log4net.Appender.ConsoleAppender,
> > log4net">
> >                         <layout type="log4net.Layout.PatternLayout, 
> > log4net">
> >                                 <param name="ConversionPattern" 
> > value="%d{ABSOLUTE} %-5p %c{1}:%L
> > - %m%n" />
> >                         </layout>
> >                 </appender>
> >                 <!-- for web -->
> >                 <appender name="web" 
> > type="log4net.Appender.AspNetTraceAppender,
> > log4net">
> >                         <layout type="log4net.Layout.PatternLayout,log4net">
> >                                 <param name="ConversionPattern" 
> > value="%d{ABSOLUTE} %-5p %c{1}:%L
> > - %m%n" />
> >                         </layout>
> >                 </appender>
> >                 <logger name="NHibernate.SQL">
> >                         <priority value="DEBUG" />
> >                         <!-- choose web or console -->
> >                         <appender-ref ref="console" />
> >                 </logger>
> >         </log4net>
> > ...
> > </configuration>
>
> > Then, on your code, add this line before using NHibernate:
>
> > XmlConfigurator.Configure();
>
> > On Jun 28, 5:50 pm, raffaeu <[email protected]> wrote:
>
> > > Hi guys, I just noticed that sometimes, but not always, NHibernate
> > > does not generate in the trace all the SQL statements it fires...
> > > I am using Resharper with nUnit and NHibernate profiler and none of
> > > them is able to see the "hidden" statement.
>
> > > I have an entity Person and an entity Address.
> > > Person has a <bag> of Address with inverse="true" and I create them in
> > > this way:
>
> > > Person person = new ...
> > > Address address = new Address(person) // here I add the back reference
> > > person.AddAddress(address)
>
> > > // save
>
> > > ISession session = factory.GetSession();
> > > session.Save(address);
>
> > > // I can see only the statement:
> > > INSERT INTO ADDRESS
>
> > > // but I can't see the statement:
> > > INSERT INTO PERSON
>
> > > but the record in the Person table is properly added ...
> > > Why?

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to