Export to GitHub

mybatisnet - issue #7

Log file is not created when using log4Net logger


Posted on Aug 10, 2010 by Swift Horse

What version of the MyBatis.NET are you using? ibatis.datamapper.1.6.2. VS 2008

Please describe the problem. Unit tests are best! Iam new to Ibatis.... Log file is not created at all after trying all the tricks...what am i doing wrong?

assemble.info file is in properties folder web.config,log4net.config: in main project folder

Assembly.info file has: [assembly: log4net.Config.XmlConfiguratorAttribute(ConfigFile = "log4net.config", Watch = true)]

Web.config file <sectionGroup name="iBATIS"> <section name="logging" type="IBatisNet.Common.Logging.ConfigurationSectionHandler, IBatisNet.Common" /> </sectionGroup> <iBATIS> <logging> <logFactoryAdapter type="IBatisNet.Common.Logging.Impl.Log4NetLoggerFA, IBatisNet.Common.Logging.Log4Net"> <arg key="configType" value="FILE-WATCH" /> <arg key="configFile" value="log4net.config" /> </logFactoryAdapter> </logging> </iBATIS>

finally log4net.config has <configSections> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> </configSections>

<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <file value="Estatlog.txt" /> <appendToFile value="true" /> <maximumFileSize value="5MB" /> <maxSizeRollBackups value="-1" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%5level [%date] %-40.40logger{2} %message%newline" /> </layout> </appender> <root> <level value="ERROR" /> <appender-ref ref="RollingLogFileAppender" /> <appender-ref ref="ConsoleAppender" /> </root>

    &lt;!-- Print only messages of level DEBUG or above in the packages --&gt;
    &lt;logger name=&quot;IBatisNet.DataMapper.Commands.DefaultPreparedCommand&quot;&gt;
        &lt;level value=&quot;ALL&quot; /&gt;
    &lt;/logger&gt;
    &lt;logger name=&quot;IBatisNet.DataMapper.Configuration.Cache.CacheModel&quot;&gt;
        &lt;level value=&quot;ALL&quot; /&gt;
    &lt;/logger&gt;

What is the expected output? What do you see instead? a Estatlog.txt log file created in the project folder

Please provide any additional information below.

y

Comment #1

Posted on Jun 8, 2012 by Grumpy Horse

Any update on this.I am also getting same issue.

Comment #2

Posted on Jun 23, 2014 by Happy Kangaroo

I experienced the same problem. andI was so resolved. log4net.dll down grade. log4net 1.2.13.0 > log4net 1.2.10.0

Status: New

Labels:
Type-Defect Priority-Low