nHibernate Log Isolation

1,003 views

Published on

Published in: Business, Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,003
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
25
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

nHibernate Log Isolation

  1. 1. nHibernateLog Isolation<br />Albert Kuo<br />
  2. 2. Problem<br />Solution<br />How to do<br />Configure log4net config file<br />Declare ILog instance<br />Check result<br />Agenda<br />
  3. 3. Problem<br />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<br />
  4. 4. Solution<br />Separate them into two logs. One for system log, another one is nHibernate log.<br />System Log<br />nHibernate Log<br />D:/temp/SystemLog<br />D:/temp/nHibernate<br />
  5. 5. How to do?<br />
  6. 6. Define two appenders. One is for system log, another one is for nHibenrate<br />Configure log4net config file<br />
  7. 7. Configure log4net config file – cont.<br />
  8. 8. Configure log4net config file – cont.<br />
  9. 9. Declare ILog instance<br />
  10. 10. 2009-10-02 10:55:37,687 DEBUG Web.Index.search(C:Documents and SettingsAdministratorMy DocumentsVisual Studio 2008ProjectsHelloNHibernateWebIndex.aspx.cs:62) - enter search function....<br />Check result(system log)<br />
  11. 11. Check result(nHibernate log)<br />
  12. 12. How to configure Log4Net for use with Nhibernate<br />http://blogs.hibernatingrhinos.com/nhibernate/archive/2008/07/01/how-to-configure-log4net-for-use-with-nhibernate.aspx<br />Isolating NHibernateLogging<br />http://geekswithblogs.net/opiesblog/archive/2006/09/29/92721.aspx<br />Viewing the SQL generated by Nhibernate<br />http://www.davesquared.net/2008/01/viewing-sql-generated-by-nhibernate.html<br />Reference<br />

×