Unable to clear contents of .log file

This only started in recent updates but not sure from exactly which version. But it was from the version that brought better formatting and syntax highlighting of debug logs.

I create WordPress plugins and Web Apps and I always have debug mode enabled so that all PHP errors are logged to a debug.log file. This file is usually pinned as a tab inside PHPStorm for the respective project so I can keep an eye on error logs while working on the project.

The issue is that at some point, this tab becomes somewhat read only and I can no longer delete the contents of the log file. I have to open the log file inside VSCode or TextEdit to clear its contents. At which point, PHPStorm sees the change but sometimes is unable to refresh itself and it sends PHPStorm into high CPU usage.

I need to then use Activity Monitor to force quit PHPStorm and reopen it so that it then shows the empty debug.log file.

 

I'm on a Macbook Pro with M3 Pro Chip

 

 

0
3 comments
Hello,

I take it, we're talking about wp-content/debug.log enabled via WP_DEBUG_LOG, right?

When it becomes readonly, could you check if the file is "locked" by any other process perhaps?
`# lsof | grep "debug\.log"`

Or if it's on windows, you can use ProcessMonitor to see if the file is locked.
0

Stefan Iakubov Entering the command didn't come up with an output after it ran for 11 seconds, so i assume there was no other process using it.

I'd like to point out that sometimes restarting PHP storm allows me to then delete the contents. But thats not always the case…and this shouldn't be happening in the first place since it requires me either force quitting PHPStorm or restarting

0

Hello,

1. Does the IDE display the file as locked in the UI?

2. Can you replicate this with other files which get a constant input into them? You can for example try to replicate it by opening a terminal and putting `while true ; do sleep 0.2 && echo $RANDOM |base64 >> /tmp/test.log ; done` in there. Then just add the `/tmp/test.log` to the ide to see if we can localize the behavior.

0

Please sign in to leave a comment.