We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Help on Phalcon\Logger\Adapter\File() how to detect if not exist?

How can I check if file does not exist? or force create a file?

I found this on the documentation and it's not working.


use Phalcon\Logger\Adapter\File as FileAdapter;

// Create the file logger in 'w' mode
$logger = new FileAdapter("app/logs/test.log", array(
    'mode' => 'w'


chmod 777 app/logs

if it not resolved you have to change permission group and user in your folder "logs"