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 Jul 11, 2:43 pm, lszk <[email protected]> wrote:
> I want to show on the console ALL the sql that is generated by
> NHibernate.
> This is my configuration for now:
>
>  var configure = new Configuration();
>             configure.SessionFactoryName("BuildIt");
>             //NHibernate.Cfg.Environment.ShowSql = "true";
>             configure.DataBaseIntegration(db =>
>             {
>                 db.Dialect<MsSql2008Dialect>();
>                 db.Driver<SqlClientDriver>();
>                 db.KeywordsAutoImport = Hbm2DDLKeyWords.AutoQuote;
>                 db.IsolationLevel = IsolationLevel.ReadCommitted;
>                 db.ConnectionString = "conn string";
>                 db.Timeout = 10;
>
>                 db.LogFormattedSql = true;
>                 db.LogSqlInConsole = true;
>                 db.AutoCommentSql = true;
>             });
> Using it, I have logged on the console only the SELECT statements. But
> I need to have INSERT and UPDATE either.
> Where should I look for some info, what to change?
>
> And second. Can somebody tell me, where can I find a documentation/
> examples on mapping by code? This is the new mapping available in
> NHibernate 3.2.

-- 
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