Note that there are some explanatory texts on larger screens.

plurals
  1. POCommon log4net logging for different instances of a dll
    primarykey
    data
    text
    <p>I'm having trouble configuring log4net to work the way I want. I have a class library Library.dll that is used both by my application Mine.exe and a third party aplication Other.exe. I have another class library Util.dll that is used by both Mine.exe and Library.dll.</p> <p>Mine.exe and Other.exe are run in parallel and I want the two instances of Library.dll to use the same logfile. It should also be separate from the logfile of Mine.exe. Util.dll should log to Library.dll logfile when called from Library.dll, and the Mine.exe logfile when called from Mine.exe.</p> <p><strong>Edit: I guess that was a bit hard to follow, this is how I want i to work:</strong></p> <p>Mine.exe logs to Mine.log<br> Other.exe doesn't log anything (third party application)<br> Mine.exe -> Library.dll logs to C:\Library.log<br> Other.exe -> Library.dll logs to C:\Library.log<br> Mine.exe -> Util.dll logs to Mine.log<br> Mine.exe -> Library.dll -> Util.dll logs to C:\Library.log<br> Other.exe -> Library.dll -> Util.dll logs to C:\Library.log Other.exe doesn't call Util.dll directly.</p> <p>First I tried loading a custom log4net configuration in Library.dll, using:</p> <pre><code>log4net.Config.XmlConfigurator.Configure(new FileInfo("Library.log4net.config")); </code></pre> <p>But that resulted in Mine.exe also logging to the Library.dll logfile.</p> <p>I then tried adding the following assembly attribute in Library.dll:</p> <pre><code>[assembly: log4net.Config.Repository("Library")] </code></pre> <p>That kept the logs separate, but then Util.dll logged to the Mine.exe logfile even when called from Library.dll. I guess I could use Repository("Util") in Util.dll, AliasReposity("Util", "Library") in Library.dll and AliasReposity("Util", "Mine") in Mine.exe but I actually have many class libraries in the project and would rather not go down that route.</p> <p>Any ideas on how to get this working?</p> <p>/Andreas</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload