Writing logs to file system using PHP in App Platform

Posted August 31, 2021 163 views
PHPDigitalOcean App Platform

I have a custom PHP app that logs some data to the /logs folder - it contains many files - one file for each type of log request which stores log info using PHP’s fileputcontents command.

This log folder is not getting pushed to the GitHub repo.
But I understand that any change in the girhub repo will re-deploy to the App Platform and will overwrite all files in the filesystem ?

Will be log files be retained or erased ?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hey there,

The local storage in App Platform is ephemeral. As such those logs would be erased on each deploy. I’d recommend saving those logs to an external file storage service like our Spaces product. Spaces :: How to Store Data in App Platform

Hope that helps!