Review main Abandoned

21257[FEATURE] Add a GrayLog Writer

Georg Ringer CR 0 V 0 Hard +799 −0 updated 06/12/13, 11:42

Commit message

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 10

Review log 4

  1. Mr. Jenkins commented on patch set 1 06/06/13, 12:43

  2. Steffen Müller commented on patch set 1 CR -1 06/06/13, 13:13

    IMO we should only put php and licence files into contrib. See also my inline comments.

    GraylogWriter.php:58

    We put the require_once() calls into the constructor? Every instanciation of a new GreylogWriter would call this.

    GraylogWriter.php:69

    No exception thrown in this function

    GraylogWriter.php:75

    use (int)($record->getCreated()

    GraylogWriter.php:99

    Why do you add this backtrace on runtime to any log record? Afaik backtrace is not required in GELF, so we could optionally use the backtrace from $record->data['file']... from the IntrospectionProcessor. This processor can be configured whenever it's needed. This would save processing time for any record which does not need backtrace
  3. Ernesto Baschny commented on patch set 1 CR -1 06/06/13, 17:08

    Apart from the comments from Steffen, I would also consider the LICENCEing problems. This is not a GPL license. It looks open source, but it's not simply MIT, GPLv2 or something. We still have pending questions regarding other contrib packages, we just don't need yet another one. In fact, I consider this library too much overhead for a rather simple task and a very simple protocol. If I read the code correctly, the "procedure" to get something logged to Graylog can be reduced to something like this: $message = gzcompress(json_encode(array( 'version' => self::GRAYLOG2_GELF_VERSION, 'timestamp' => $GLOBALS['EXEC_TIME'], 'short_message' => $record->getMessage(), 'full_message' => $record->getMessage(), 'facility' => $this->facility, 'host' => \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_HOST'), 'level' => $record->getLevel(), ))); $socket = stream_socket_client(sprintf('udp://%s:%d', gethostbyname($hostname), $port)); if (str_len($message) > $chunkSize) { str_split($message, $chunkSize); $messageId = randomstuff(); foreach ($chunk) { $chunk = pack('CC', 30, 15) . substr(md5($messageId, true), 0, 8) . pack('CC', $sequence, $sequenceSize) . $data; fwrite($socket, $chunk); } } else { fwrite($socket, $message); } So I would rather simply include some code like this (of course finished and tested..) in our GelfLogger implementation instead of adding a dependency to an external library.
  4. Georg Ringer abandoned the change 06/12/13, 11:42