fluent / fluent-logger-php

A structured logger for Fluentd (PHP)
Other
215 stars 57 forks source link

Losing logs + lots of lines in stderr (error.log nginx) #51

Open gioialorusso opened 7 years ago

gioialorusso commented 7 years ago

Hi, We have a problem with the fluentd-logger-php class. Sometimes it goes in error (we haven't realize yet why, but we think it could be a socket connection error) and it writes in stderr a blob of things:

  1. It writes what we are trying to send to fluentd (application logs)
  2. Plus, it writes the php errors collected during the script, like notices for example (and our error level configured in php.ini file excludes the notices, so it is strange). Writing in stderr causes us a lot of noise in the nginx error.log, and, furthermore, we loose the application logs forever. The fluentd, even if is in debug mode, doesn't write anything when this problem happens. We experimentally caused a socket connection error modifying the library code (in development environment) and we got the problematic behaviour (wrote lines in error.log nginx). This is why we believe that this could be the problem.

Now, we want to understand some things:

  1. we would like to know precisely why this is happening and how we can detect the exact problem.
  2. we cannot have these lines of logs wrote in stderr, because in this way we cannot navigate the nginx logs to analyze them easily.
  3. we would like to not loose the log, but have something to retry the writing if something goes wrong, is this possible?

Thanks, Gioia

gioialorusso commented 7 years ago

I forget to attach an error example: 2017/10/03 03:46:55 [error] 25083#25083: *38965696 FastCGI sent in stderr: "PHP message: Fluent\Logger\FluentLogger Undefined index: css log: {"a very long application log in json format"}