logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Dejardin <pdejar...@factset.com>
Subject RE: Duplicate log entries with DLL/EXE combination
Date Fri, 27 Apr 2012 12:56:00 GMT
How are you configuring? (programmatically, custom attribute, etc.) My guess would be that
the 'DebugAppender' is being added twice (once in two separate repositories). You could use
the same Repository for both assemblies. How are you creating loggers in code?

From: Kramer, Mat [mailto:MKramer@datasci.com]
Sent: Thursday, April 26, 2012 7:02 PM
To: log4net-user@logging.apache.org
Subject: Duplicate log entries with DLL/EXE combination

Hello,

We have a .NET executable and a DLL assembly that both use log4net.  One of the complications
is that the DLL is also called from an unmanaged C++ application and we want logging to work
in that setting.  Our current solution works, but I get many duplicate log entries when I
am running the .NET EXE with the .NET DLL.  The configurations are below.  Any ideas for how
to fix this?  I have to admit I don't really understand how it works now.

Thanks!

Application configuration

<log4net>

  <appender name="DebugAppender" type="log4net.Appender.RollingFileAppender">
    <file value="log-file-fauxnemah.txt" />
    <appendToFile value="true" />
    <rollingStyle value="Size" />
    <maxSizeRollBackups value="10" />
    <maximumFileSize value="50MB" />
    <staticLogFileName value="true" />
    <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%date %7level [%2thread] %message%newline" />
    </layout>
  </appender>

  <root>
    <level value="ALL" />
    <appender-ref ref="DebugAppender" />
  </root>

</log4net>

DLL configuration

<log4net>

  <appender name="DebugAppender" type="log4net.Appender.RollingFileAppender">
    <file value="TruSense//log-file-trusenseP3P.txt" />
    <appendToFile value="true" />
    <rollingStyle value="Size" />
    <maxSizeRollBackups value="10" />
    <maximumFileSize value="50MB" />
    <staticLogFileName value="true" />
    <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%date %7level [%2thread] %message%newline" />
    </layout>
  </appender>

  <root>
    <level value="ALL" />
    <appender-ref ref="DebugAppender" />
  </root>

  <logger name="DSI.DACSS.Transformers.FahiTransformer" additivity="false">
    <level value="NONE" />
  </logger>

  <logger name="DSI.DACSS.Framework.Logger.SystemLogger" additivity="false">
    <level value="ALL" />
    <appender-ref ref="DebugAppender" />
  </logger>

</log4net>


-Mat


Mime
View raw message