Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4533612
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:10:40+00:00 2026-05-21T14:10:40+00:00

I finally tried log4net for my WPF desktop application. I’m struggling with the fact

  • 0

I finally tried log4net for my WPF desktop application.

I’m struggling with the fact that RollingFileAppender has no built in support for multiple instance application.

I don’t like an idea of restricting the application to single instance just to make logger happy. Single intstance tricks are all ugly hacks.

Using process ID in the filename of the log file is also not good enough. This has potential of eating up unlimited space, since RollingFileAppender is useless in this situation.

One solution would probably be to send logs to different process, which would take care of serializing the output into files. But this creates new headaches.

What’s your take on this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T14:10:40+00:00Added an answer on May 21, 2026 at 2:10 pm

    It’s not a good idea to use multiple RollingFileAppender instances from different processes writing to the same file since the RollingFileAppender isn’t designed for that scenario.

    You have a couple of choices here:

    Multiple FileAppender with minimal locking

    Use multiple FileAppender instances pointing at the same file and configured with minimal locking. This will allow concurrent write operations from multiple processes:

    <appender name="FileAppender" type="log4net.Appender.FileAppender">
        <file value="Log.txt" />
        <appendToFile value="true" />
        <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
        <layout type="log4net.Layout.PatternLayout">
            <conversionPattern
                value="%date [%thread] %-5level %logger - %message%newline" />
        </layout>
    </appender>
    

    Multiple EventLogAppender

    Use multiple EventLogAppender instances that write to a shared Windows event source:

    <appender name="EventLogAppender" type="log4net.Appender.EventLogAppender" >
        <applicationName value="MyApp" />
        <layout type="log4net.Layout.PatternLayout">
            <conversionPattern
                value="%date [%thread] %-5level %logger - %message%newline" />
        </layout>
    </appender>
    

    Of course you could also send the log to a database or to a remote component running in a different process or even a different machine but these choices require more infrastructure to be setup so it may be overkill for your scenario.

    Related resources:

    • log4net Config Examples
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Finally i tried to draw a line using OpenGL ES framework in XCode 4.2
This one is a long story: i have recently built a win32 application in
I finally focused the situation and tried a lot of trial on your website.
Finally I created a stream video recorder flash application and its simple Red5 backend
I've tried several things, but none of them work... I have Form that should
finally got reg'd as an iOS developer - tried to compile the app i
I have tried to many javascript plugins but finally had to post this question.
Tried to use rpx login form; the page was finally redirected to http://site_name/rpx_login_form Got
I just tried to subscribe to WPF property change events using C++/CLI. I didn't
Finally deployed my ruby on rails 3.2 app but when trying to open it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.