<p>For anyone else trying this: the solution I eventually came up for was to follow <a href="https://devcenter.heroku.com/articles/php-logging#adding-logging-for-legacy-applications" rel="nofollow noreferrer">these instructions</a> for adding an argument to the Procfile to tell Heroku to tail Craft's log file into the "Logplex" stream.</p>

<p>There might well be situations where Brad's suggestion (using a plugin to write the logs to stderr) is preferable, but I wasn't sure what the implications would be for logs in development (where it's fine for them to be written to the file system). Adding an argument to the Procfile side-steps this issue, since it's only run by Heroku.</p>

<p>My Procfile now looks like this:</p>

<pre><code>web: vendor/bin/heroku-php-nginx -C nginx_app.conf -l storage/logs/web.log web
</code></pre>

CC BY-SA 4.0
2020-01-23T21:50:54.937Z
Nick, did this resolve the database backup issue? Also, would you consider sharing your nginx_app.conf? Trying to make craftcms work with nginx...
aaandre
CC BY-SA 4.0
2018-11-06T18:32:13.133Z
2018-11-06T18:32:13.133Z
Nick F
<p>Not super familiar with Heroku, but some Googling suggests and if you want to keep anything on a permanent (non-ephemeral) file system, most people use S3 for that.</p>

<p>There is the <code>CRAFT_STORAGE_PATH</code> PHP constant for both Craft 2 and 3, but it's currently assuming local file-system based paths and making it cloud based would cause a big performance hit anyway.</p>

<p>You're probably better off solving this with plugins.</p>

<p>Specifically things like this for logs: <a href="https://github.com/ostark/craft-stderr-logger" rel="nofollow noreferrer">https://github.com/ostark/craft-stderr-logger</a></p>

<p>And database backup plugins that have the option to write to S3.</p>

CC BY-SA 3.0
2018-03-16T21:12:03.893Z
2018-03-16T21:12:03.893Z
Brad Bell
<p>I'm using Heroku to host a Craft 3 site, and it's working fine, apart from the fact that Craft isn't able to write to the <code>/storage</code> folder (or anywhere else, for that matter). Consequently, the Database Backup utility doesn't work and nor is Craft able to write logs. I'm keen to fix both these issues.</p>

<p>Has anyone managed to solve this problem on Heroku? If so, how?</p>

<craft3><storage><heroku>
Getting Craft's storage folder to work on Heroku
# Getting Craft's storage folder to work on Heroku

(Asked by: username_0 on 2018-03-16)

I'm using Heroku to host a Craft 3 site, and it's working fine, apart from the fact that Craft isn't able to write to the `/storage` folder (or anywhere else, for that matter). Consequently, the Database Backup utility doesn't work and nor is Craft able to write logs. I'm keen to fix both these issues.

Has anyone managed to solve this problem on Heroku? If so, how?

**Tags:** craft3, storage, heroku

---

## 2 answers

### Answer by username_0 on 2018-11-06. Score: 2 | Accepted answer

For anyone else trying this: the solution I eventually came up for was to follow these instructions for adding an argument to the Procfile to tell Heroku to tail Craft's log file into the "Logplex" stream.
There might well be situations where Brad's suggestion (using a plugin to write the logs to stderr) is preferable, but I wasn't sure what the implications would be for logs in development (where it's fine for them to be written to the file system). Adding an argument to the Procfile side-steps this issue, since it's only run by Heroku.
My Procfile now looks like this:
web: vendor/bin/heroku-php-nginx -C nginx_app.conf -l storage/logs/web.log web

> **Comments:**
> **username_1**: Nick, did this resolve the database backup issue? Also, would you consider sharing your nginx_app.conf? Trying to make craftcms work with nginx...  

---

### Answer by username_2 on 2018-03-16. Score: 1

Not super familiar with Heroku, but some Googling suggests and if you want to keep anything on a permanent (non-ephemeral) file system, most people use S3 for that.

There is the `CRAFT_STORAGE_PATH` PHP constant for both Craft 2 and 3, but it's currently assuming local file-system based paths and making it cloud based would cause a big performance hit anyway.

You're probably better off solving this with plugins.

Specifically things like this for logs: <https://github.com/ostark/craft-stderr-logger>

And database backup plugins that have the option to write to S3.


---

