<p>Turns out that what I had was actually creating the files but in a <code>@runtime/temp/debug</code> folder inside the web root. Parsing that string with <code>App::parseEnv()</code> did the trick, and the debugging files are now created successfully inside <code>/storage/runtime/temp/debug</code> and cleared with the <code>clear-caches/temp-files</code> console command:</p>
<pre class="lang-php prettyprint-override"><code>use craft\helpers\App;

return [
    'dataPath' =&gt; App::parseEnv('@runtime/temp/debug')
];
</code></pre>

CC BY-SA 4.0
2023-02-08T20:42:35.833Z
2023-02-08T20:42:35.833Z
jrrdnx
<p>According to <a href="https://github.com/craftcms/cms/pull/10825" rel="nofollow noreferrer">Pull Request #10825</a> for Craft 4, you can override the filesystem and path where the debugger files are stored for the Debug Toolbar. In the absence of using a separate filesystem, I'd like to be able to store these somewhere inside of the @runtime/temp folder since there is a <code>clear-caches/temp-files</code> command to clear this directory but not one specifically for the <code>@runtime/debug</code> folder.</p>
<p>So far, I've added a <code>config/debug.php</code> file that contains the following:</p>
<pre class="lang-php prettyprint-override"><code>return [
    'dataPath' =&gt; '@runtime/temp/debug',
];
</code></pre>
<p>But the only effect this seems to have is 1) when it's set to <code>@runtime/debug</code> the files are created successfully in their normal location, or 2) for any other value the files aren't created whatsoever.</p>
<p>I looked into adding an action to the <a href="https://github.com/craftcms/cms/blob/develop/src/utilities/ClearCaches.php" rel="nofollow noreferrer">ClearCaches Utility</a> specifically for clearing the debug folder, but after coming across the above pull request I wasn't sure how to implement it in such a way that would account for custom filesystems, so I thought just moving it to within another folder that's cleared when running a <code>clear-caches</code> command would be easier.</p>

<craft4><commands><debug>
How to change file path where the Debug Toolbar's debugger files are stored?
# How to change file path where the Debug Toolbar's debugger files are stored?

(Asked by: username_0 on 2023-02-03)

According to Pull Request #10825 for Craft 4, you can override the filesystem and path where the debugger files are stored for the Debug Toolbar. In the absence of using a separate filesystem, I'd like to be able to store these somewhere inside of the @runtime/temp folder since there is a clear-caches/temp-files command to clear this directory but not one specifically for the @runtime/debug folder.
So far, I've added a config/debug.php file that contains the following:
return [
    'dataPath' => '@runtime/temp/debug',
];

But the only effect this seems to have is 1) when it's set to @runtime/debug the files are created successfully in their normal location, or 2) for any other value the files aren't created whatsoever.
I looked into adding an action to the ClearCaches Utility specifically for clearing the debug folder, but after coming across the above pull request I wasn't sure how to implement it in such a way that would account for custom filesystems, so I thought just moving it to within another folder that's cleared when running a clear-caches command would be easier.

**Tags:** craft4, commands, debug

---

## 1 answers

### Answer by username_0 on 2023-02-08. Score: 1 | Accepted answer

Turns out that what I had was actually creating the files but in a @runtime/temp/debug folder inside the web root. Parsing that string with App::parseEnv() did the trick, and the debugging files are now created successfully inside /storage/runtime/temp/debug and cleared with the clear-caches/temp-files console command:
use craft\helpers\App;

return [
    'dataPath' => App::parseEnv('@runtime/temp/debug')
];


---

