When you say multiple assemblies, I assume you mean multiple
processes?  Logging this way is not suggested as for each log message
you have to reopen the file.  If you have really light logging, it
would probably be ok...

Look at the LockingModel:
http://logging.apache.org/log4net/release/sdk/log4net.Appender.FileAppender.LockingModel.html

>From http://logging.apache.org/log4net/release/config-examples.html:

This example shows how to configure the appender to use the minimal
locking model that allows multiple processes to write to the same
file.

<appender name="FileAppender" type="log4net.Appender.FileAppender">
    <file value="${TMP}\log-file.txt" />
    <appendToFile value="true" />
    <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
    <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date [%thread] %-5level %logger
[%property{NDC}] - %message%newline" />
    </layout>
</appender>

On Wed, Sep 2, 2009 at 3:28 AM, mattyboy<[email protected]> wrote:
>
> Hi Christian,
>
> I'm actually looking to achieve the opposite, I want to know if it's
> possible to get several assemblies to log to the SAME log file.  Have you
> managed to achieve this?  If so, do you have any example code/configs etc.?
>
> Many Thanks
>
>
> cristianmad wrote:
>>
>> Hi,
>>
>> I am new to log4net and just starting reading some documentation about it.
>> We need to see if it would be a suitable logging solution for our
>> applications.
>> Our product (like most of them) uses a number of assemblies. I was
>> wondering if it would be possible for each assembly to log in its own log
>> file (or any other destination) even if they are loaded in the same
>> application domain.
>> For example consider we have the following assemblies: A.dll and B.dll. Is
>> it possible for the two assemblies to log in their own log files even if
>> they are loaded in the same application domain?
>> If yes, could you please give me a very simple example?
>>
>>
>> Thank you,
>> Cristian
>>
>
> --
> View this message in context: 
> http://www.nabble.com/Log-in-more-than-1-log-destination-for-different-assemblies.-tp24807634p25253548.html
> Sent from the Log4net - Users mailing list archive at Nabble.com.
>
>

Reply via email to