RE: [ExcelDna] Log file Not created

356 views
Skip to first unread message

Govert van Drimmelen

unread,
Oct 11, 2012, 4:42:14 AM10/11/12
to exce...@googlegroups.com
Hi Soumya,

I think you are mixing different ways of getting the log4net configuration loaded.
By putting your config info in the .xll.config file, you are actually using the ".config Files" option described in the log4net manual here http://logging.apache.org/log4net/release/manual/configuration.html.

I think then you must _not_ have the [assembly: log4net.Config.XmlConfigurator...] attribute, and instead make a call to log4net.Config.XmlConfigurator.Configure() in your AutoOpen().

I haven't tried it myself, so I hope that puts you on the right track.

Regards,
Govert



From: exce...@googlegroups.com [exce...@googlegroups.com] on behalf of Soumya [soum...@algotree.com]
Sent: 11 October 2012 07:49 AM
To: exce...@googlegroups.com
Subject: [ExcelDna] Log file Not created

I use log4net for logging in My ClassLibrary Project
I had done all the necessary configurations but log files are not created for me !!!

added reference to log4net.dll in project.
created FirstAddIn.xll.config as
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
  </configSections>
  <log4net>
    <appender name="FileAppender" type="log4net.Appender.FileAppender">
      <file value="C:\logfile.txt" />
      <appendToFile value="true" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] – %message%newline" />
      </layout>
    </appender>
    <root>
      <level value="DEBUG" />
      <appender-ref ref="FileAppender" />
    </root>
  </log4net>
</configuration>

added to Assembly.cs
[assembly: log4net.Config.XmlConfigurator(
ConfigFile = "FirstAddIn.xll.config", Watch = true)] 

Then I call  private static readonly ILog log = LogManager.GetLogger(typeof(ESIntegration));
log.info("testing");

This works without any error but log file is not getting created !!!
how can I make this work ?

--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To view this discussion on the web visit https://groups.google.com/d/msg/exceldna/-/R8zxRnieTwkJ.
To post to this group, send email to exce...@googlegroups.com.
To unsubscribe from this group, send email to exceldna+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/exceldna?hl=en.
Reply all
Reply to author
Forward
0 new messages