Start a conversation

Restoring Logging After Deleting the `production.log` File

Overview

If you accidentally delete your application's production.log file, it can disrupt the logging mechanism, making it difficult to monitor and diagnose issues. This article provides steps to recreate the log file and ensure logging resumes correctly.

Information

To resolve issues with a deleted production.log file and resume logging, follow these steps:

  1. Recreate the Log File:
    • SSH into your application server.
    • Navigate to the log directory, typically /data/YOUR_APP_NAME/shared/log/.
    • Use the following command to create a new production.log file:
      touch production.log
    • Set the appropriate permissions:
      chmod 0664 production.log
      chown deploy:deploy production.log
  2. Restart the Application:
    • Restart Unicorn to reinitialize logging to the new file:
      /engineyard/bin/app_Cluster deploy
  3. Verify Logging:
    • Check if the log file is being populated with logs.
    • Monitor your system to ensure logging is functioning as expected.

If issues persist, ensure your application's configuration files are set to write logs to the correct path and that the environment is correctly configured to handle log file creation and rotation.

Frequently Asked Questions

What should I do if logs are still not being written after recreating the log file?
Ensure that the application is not writing to a file descriptor pointing to the old, deleted log file. Restarting the application, such as Unicorn, can help reinitialize logging to the new file.
How can I prevent accidental deletion of log files in the future?
Implement a backup strategy for critical log files and ensure proper permissions and ownership to prevent accidental deletions.
What permissions should the production.log file have?
The production.log file should have 0664 permissions and be owned by the user that runs your application, typically the deploy user.
Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Priyanka Bhotika

  2. Posted

Comments