Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Log4Net with MVC

Status
Not open for further replies.

dinger2121

Programmer
Sep 11, 2007
439
US
Hello,
I have an mvc application and I would like to use log4net for debugging. I am using NHibernate. My application has my main project which contains my controllers and views. I also have a DAL in which the NHibernate mappings are set up.
When setting up log4net, do I have to add the dll references in my main project only, or in my dal also? Also, where do I add my config info?

Thanks for any thoughts.

carl
MCSD, MCTS:MOSS
 
I was able to get this working by using the following post -

I then changed the line -
Code:
    <logger name="NHibernate" additivity="false">
      <level value="DEBUG"/>
      <appender-ref ref=" GeneralLog"/>
    </logger>

to

Code:
    <logger name="NHibernate.SQL" additivity="false">
      <level value="INFO"/>
      <appender-ref ref=" GeneralLog"/>
    </logger>

carl
MCSD, MCTS:MOSS
 
Sorry - I forgot to mention that I added the reference to the log4net dll in my main project. I also added the configuration information in my main project's web.config file.

carl
MCSD, MCTS:MOSS
 
so everything is working now?

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
faq732-7259
 
I didn't have too much time to work with it yesterday. I was able to get the NHibernate information to log, but no generated sql statements.

I will work with it further today and post my results.

carl
MCSD, MCTS:MOSS
 
Yes, everything is working correctly now. I found that I had a 100k max size set on the log file (carried over from the example I used). This was cutting off the log file so I couldn't see the sql. After I removed it, everything was working fine.

Thanks

carl
MCSD, MCTS:MOSS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top