Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModuleshow to enable nhibernate logging in DNN6?how to enable nhibernate logging in DNN6?
Previous
 
Next
New Post
4/23/2012 1:03 AM
 

Hi, everyone, 

in the DNN6, there is DotNetNuke.Log4Net.dll in the Bin folder

and there is config file: DotNetNuke.log4net.config, the content of this file as below: 

----------------------

<?xml version="1.0" encoding="utf-8" ?>
<log4net>
  <appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
    <file value="Portals/_default/Logs/" />
    <datePattern value="yyyy.MM.dd'.log.resources'" />
    <rollingStyle value="Date" />
    <staticLogFileName value="false" />
    <appendToFile value="true" />
    <maximumFileSize value="10MB" />
    <maxSizeRollBackups value="5" />
    <lockingModel type="log4net.Appender.FileAppender+MinimalLock"/>
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%date [%property{log4net:HostName}][Thread:%thread][%level] %logger - %message%newline" />
      <locationInfo value="true" />
    </layout>
  </appender>
  <appender name="nHibernateAppender" type="log4net.Appender.RollingFileAppender">
    <file value="Portals/_default/Logs/system.log"/>
    <appendToFile value="true"/>
    <rollingStyle value="Size"/>
    <param name="DatePattern" value="dd/MM/yyyy"/>
    <maxSizeRollBackups value="10"/>
    <maximumFileSize value="10MB"/>
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%date [%thread] %-5level  %logger - %message%newline"/>
    </layout>
  </appender>
  <appender name="nHibernateAppender.SQL" type="log4net.Appender.RollingFileAppender">
    <file value="Portals/_default/Logs/system.sql.log"/>
    <appendToFile value="true"/>
    <rollingStyle value="Size"/>
    <maxSizeRollBackups value="10"/>
    <maximumFileSize value="10MB"/>
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%date [%thread] %-5level  %logger - %message%newline"/>
    </layout>
  </appender>
  <logger name="NHibernate">
    <level value="WARN"/>
    <appender-ref ref="nHibernateAppender"/>
  </logger>
  <logger name="NHibernate.SQL">
    <level value="ALL"/>
    <priority value="DEBUG"/>
    <appender-ref ref="nHibernateAppender.SQL"/>
  </logger>
  <root>
    <level value="ERROR"/>
    <appender-ref ref="RollingFile"/>
  </root>
  
</log4net>

-------------------------------

in my custom module, i have added code: 

log4net.Config.XmlConfigurator.Configure(new FileInfo(Server.MapPath("/DotNetNuke.log4net.config")));

in method "Page_Init". 

and i have added : 

[assembly: log4net.Config.XmlConfigurator(Watch = true)]

in my DAL.dll

but there is no sql was generated into log file. 

where was wrong?

any idea will be appreciated. Thank you



 
New Post
4/24/2012 8:32 AM
 

Unfortunately nHibernate and DotNetNuke do not play well together in this area.  This is due to the fact that nHibernate references the log4net assembly by name, and DotNetNuke has renamed the assembly.

You will need to recompile one or the other in order for the two to play nicely together.  I have only performed this recompile with nHibernate -- which works correctly -- so I recommend this route.  A search for the assembly name "log4net.dll" and replacing these tokens with "DotNetNuke.log4net.dll" should get you where you need to be (this assumes nHibernate 3.1+).

It is admittedly a bit silly that DotNetNuke renamed this assembly without also altering the namespace, but I'm not sure how two otherwise identical log4net assemblies would work side-by-side anyway.

Hope this helps!

Brandon


Brandon Haynes
BrandonHaynes.org
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModuleshow to enable nhibernate logging in DNN6?how to enable nhibernate logging in DNN6?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out