0

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?

Fractaliste
  • 151
  • 1
  • 6

2 Answers2

1

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.

1

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.

David Spillett
  • 22,754
  • 45
  • 67
  • 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 09:47