angelcool.net
angelcool.net

Reputation: 2546

Does PHP Monolog catch messages that would otherwise go to /var/log?

I'm trying to figure out if Monolog is meant to be a replacement for Nginx and Apache logs. So if I use Monolog, which I am in Laravel, would I still need to set the following configuration parameters:

Nginx:

access_log /var/log/nginx/barney-is-cool.net-access.log;
error_log /var/log/nginx/barney-is-cool.net-error.log;

Httpd:

TransferLog /var/log/httpd/hulk-is-cool.net-access-log
ErrorLog /var/log/httpd/hulk-is-cool.net-error-log

Hope my question is clear enough, thank you.

Upvotes: 0

Views: 251

Answers (1)

Gabriel Sosa
Gabriel Sosa

Reputation: 7956

No, MonoLog sits on top of laravel, so it will only log what happen within the framework.

Apache logs are in a different layer, apache logs will log the request and response (code, response length, etc.)

If you wish to log what could happen on Apache you should use the ErrorLog and CustomLog directives and pipe the output to an script that send such lines to your log repository using MonoLog

I have something like

    ErrorLog "|/usr/local/sbin/apache_error"
    CustomLog "|/usr/local/sbin/apache_syslog" syslog

Hope this helps you

Upvotes: 1

Related Questions