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 61359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:18:24+00:00 2026-05-10T18:18:24+00:00

Part of my latest webapp needs to write to file a fair amount as

  • 0

Part of my latest webapp needs to write to file a fair amount as part of its logging. One problem I’ve noticed is that if there are a few concurrent users, the writes can overwrite each other (instead of appending to file). I assume this is because of the destination file can be open in a number of places at the same time.

flock(...) is usually superb but it doesn’t appear to work on NFS… Which is a huge problem for me as the production server uses a NFS array.

The closest thing I’ve seen to an actual solution involves trying to create a lock dir and waiting until it can be created. To say this lacks elegance is understatement of the year, possibly decade.

Any better ideas?

Edit: I should add that I don’t have root on the server and doing the storage in another way isn’t really feasible any time soon, not least within my deadline.

  • 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. 2026-05-10T18:18:25+00:00Added an answer on May 10, 2026 at 6:18 pm

    Another dirty hack would be to flock() a ‘local’ file, and only open / write to the NFS file if you hold the lock on the local file.

    Edit: from the flock() page:

    flock() will not work on NFS and many other networked file systems. Check your operating system documentation for more details.

    Edit 2:

    Of course there’s always using the database to synchonise access (I’m assuming your app uses a db). This would be quite a performance hit if you’re doing a lot of logging though.

    If it’s just for logging, do you actually need a centralised log file? Could you log locally (and even combine the logs when they rotate at the end of the day if needed)?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ever since updating to the latest ADT (version 18), I've noticed that there seems
I've got the following XML snippet as part of a larger XML file that
Part of the GUI I'm building using tkinter has a pop-up window that says
Part of my web application is a background script that polls from a beanstalkd
Part of my app caches web pages for offline viewing. To do that, I
Part of my table design is to include a IsDeleted BIT column that is
Part of an app I am working on includes a log file viewer, with
Part of a complex query that our app is running contains the lines: ...(inner
The latest changesets to Ruby 1.9.2 no longer make the current directory . part
I use the latest version of Jquery-UI -- and not the one designed specifically

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.