nHibernate Log IsolationAlbert Kuo
Problem Solution How to do◦Configure log4net config file◦Declare ILog instance◦Check result
Agenda
Problem
nHibernate write lots of log during its operation. If system log and nHibernate log write into the same file, it’s will be very hard to read
SolutionSeparate them into two logs. One for system log, another one is nHibernate log.
System Log nHibernate Log
D:/temp/SystemLog D:/temp/nHibernate
Check result
System log nHibernate log
Declare ILog instance
Configure log4net config file
Appender logger
How to do?
Define two appenders. One is for system log, another one is for nHibenrate
Configure log4net config file
Configure log4net config file – cont.
Configure log4net config file – cont.
Declare ILog instance
2009-10-02 10:55:37,687 DEBUG Web.Index.search(C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\HelloNHibernate\Web\Index.aspx.cs:62) - enter search function....
Check result(system log)
Check result(nHibernate log)
How to configure Log4Net for use with Nhibernate◦ http://
blogs.hibernatingrhinos.com/nhibernate/archive/2008/07/01/how-to-configure-log4net-for-use-with-nhibernate.aspx
Isolating NHibernate Logging◦ http://
geekswithblogs.net/opiesblog/archive/2006/09/29/92721.aspx
Viewing the SQL generated by Nhibernate◦ http://
www.davesquared.net/2008/01/viewing-sql-generated-by-nhibernate.html
Reference
Top Related