I'm using a Php lib (Monolog) to create my logs.

When I delete my log file and access my website in order to generate logs, I see the file created into the good log directory:

-rw-r--r-- 1 apache apache    0 Nov 21 15:22 portal.log

But it's always empty (every request should be logged)... On the other hand the last modified date is updated every time it should generate logs.

I suspect a chmod problem, to fix it I tried a chmod 777 on the log file:

-rwxrwxrwx 1 apache apache    0 Nov 21 15:28 portal.log

But it doesn't fix the problem, same symptoms...

Did I miss something with chmod configuration?

  • Is the disk full? – Jenny D Nov 21 '14 at 15:50
  • I move my files in /var/www/html and now it works... The problem is solved but still ununderstanded – Fractaliste Nov 24 '14 at 12:04

Assuming your configuration is completely correct, if you truly believe it is a permission issue you'll need to ensure that all the folders leading up to portal.log are executable.

You can also test the file is writable by switching to the apache user sudo -u apache -s /bin/bash and running touch /path/to/portal.log.

  • touch command works fine :/ – Fractaliste Nov 24 '14 at 9:43

As it can create the log file I don't think the problem is directory permissions, and setting the permission flags to world-read-and-writable-and-executable (777) makes no difference I don't it is file permissions or ownership either.

Could the be an error in how the library is being called such that it thinks there is nothing to log yet? Is this working for you in any other environment?

Also, how much should have been logged by this point? Could the library be buffering outputs for a while instead of writing every line as it comes in? Try making sure lots should be written to rule out this.

  • The log lib is working fine on my Windows development computer, I already check if it was a path problem, but it seems good to me (it creates the file...), I don't see other things to check between my environment... – Fractaliste Nov 24 '14 at 9:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.