networkteam / sentry_client

TYPO3 Extension for exception logging with sentry, see http://www.getsentry.com
33 stars 36 forks source link

Duplicate sentry tickets when using SentryLogWriter + productionExceptionHandler #100

Closed cweiske closed 3 months ago

cweiske commented 4 months ago

When following the README and configuring the productionExceptionHandler as well as the log writerConfiguration, exceptions are reported twice to Sentry.

One is reported by the as "level: error"

TYPO3\CMS\Core\Error\Exception
PHP Warning: Undefined array key "category" in /var/www/typo3/...php line 71

stack trace:

  1. TYPO3\CMS\Core\Error\ErrorHandler::handleError line 138
  2. Sentry\ErrorHandler::handleError line 342
  3. MyClass

the other one is "level: warning"

ErrorException
Warning: Undefined array key "category"

stack trace:

  1. MyClass

The duplicate reports go away when I disable the log writer.

Now my questions:


This happens with TYPO3 12.4.13 and sentry_client 5.0.2.

My config/system/additional.php contains:

// Register exception handler                                    
$GLOBALS['TYPO3_CONF_VARS']['SYS']['productionExceptionHandler']
    = Networkteam\SentryClient\ProductionExceptionHandler::class;
// Forward log messages to Sentry                                
$GLOBALS['TYPO3_CONF_VARS']['LOG']['writerConfiguration'] = [
    \TYPO3\CMS\Core\Log\LogLevel::ERROR => [
        \Networkteam\SentryClient\SentryLogWriter::class => [],
    ],
];
christophlehmann commented 3 months ago

Log messages from Core ErrorHandler are excluded because Sentrys error Integrations are enabled.

I guess you have E_WARNING in $GLOBALS['TYPO3_CONF_VARS']['SYS']['exceptionalErrors'] which turns warnings into Exceptions and thus reported again.

christophlehmann commented 3 months ago

Is this the case?

cweiske commented 3 months ago

I do indeed have 'exceptionalErrors' => 12290 which translates to

E_WARNING | E_RECOVERABLE_ERROR | E_DEPRECATED
cweiske commented 3 months ago

The problem is gone when upgrading to 5.1.0 (without any configuration changes). Downgrading to 5.0.2 makes it appear again.