Problem with SQL Logging

22 views
Skip to first unread message

Michael Berkowitz

unread,
Jun 16, 2023, 8:35:07 AM6/16/23
to nhusers
I use log4net to log NHibernate.SQL at the Debug level.
I use the MsSql2012Dialect dialect against the latest Sql Server database.
The logged SQL is s bit different from the SQL that gets sent to the DB.  Notably, for bit fields that are mapped a Boolean, NH produces values of 1 and 0, but the logging output uses True and False.
Also, today's DateTime gets sent to the DB as '2023-06-16 08:32:09.9586347' but gets logged as 2023-06-16T08:32:09.9586347Z (different format, sans quotes).
This is inconvenient because I can't simply paste a query from the log into a database client and run it; I first have to replace the Boolean and DateTime literals so that it will run.

Can someone explain why this is happening and/or suggest a solution?

PS:  I've written a log4net PatternLayout that gets rid of the parameters (as in @p1, @p2) and puts their values inline, making the SQL more readable.  I'm happy to share it if anyone's interested.
Reply all
Reply to author
Forward
0 new messages