nhibernate log isolation

Post on 19-May-2015

851 Views

Category:

Business

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

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)

top related