fix(InitializerProcessor): Add error logging for failed initializer registration
- Add LogContext import for structured error logging - Replace silent exception catching with detailed error logging - Log class, method, return_type, and full exception details - Helps diagnose DatabasePlatform initializer issues in production - Maintains application stability by skipping failed initializers
This commit is contained in:
@@ -37,11 +37,10 @@ RUN docker-php-ext-install -j$(nproc) \
|
|||||||
shmop \
|
shmop \
|
||||||
bcmath
|
bcmath
|
||||||
|
|
||||||
# Enable ext-uri for PHP 8.5 WHATWG URL support
|
# Note: ext-uri is built-in to PHP 8.5+ core, no installation needed
|
||||||
RUN docker-php-ext-enable uri
|
|
||||||
|
|
||||||
# Install PECL extensions
|
# Install PECL extensions (use beta redis for PHP 8.5 compatibility)
|
||||||
RUN pecl install apcu redis \
|
RUN pecl install apcu redis-6.3.0RC1 \
|
||||||
&& docker-php-ext-enable apcu redis
|
&& docker-php-ext-enable apcu redis
|
||||||
|
|
||||||
RUN echo "apc.enable_cli=1" >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini \
|
RUN echo "apc.enable_cli=1" >> /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini \
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ use App\Framework\DI\InitializerDependencyGraph;
|
|||||||
use App\Framework\DI\ValueObjects\DependencyGraphNode;
|
use App\Framework\DI\ValueObjects\DependencyGraphNode;
|
||||||
use App\Framework\Discovery\Results\DiscoveryRegistry;
|
use App\Framework\Discovery\Results\DiscoveryRegistry;
|
||||||
use App\Framework\Logging\Logger;
|
use App\Framework\Logging\Logger;
|
||||||
|
use App\Framework\Logging\ValueObjects\LogContext;
|
||||||
use App\Framework\Reflection\ReflectionProvider;
|
use App\Framework\Reflection\ReflectionProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -81,9 +82,16 @@ final readonly class InitializerProcessor
|
|||||||
$dependencyGraph->addInitializer($returnType, $discoveredAttribute->className, $methodName);
|
$dependencyGraph->addInitializer($returnType, $discoveredAttribute->className, $methodName);
|
||||||
}
|
}
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
|
$logger?->error(
|
||||||
|
"Failed to register initializer: {$discoveredAttribute->className->toString()}::{$methodName->toString()}",
|
||||||
|
LogContext::withExceptionAndData($e, [
|
||||||
|
'class' => $discoveredAttribute->className->toString(),
|
||||||
|
'method' => $methodName->toString(),
|
||||||
|
'return_type' => $returnType,
|
||||||
|
])
|
||||||
|
);
|
||||||
|
|
||||||
|
// Skip failed initializers to prevent breaking the entire application
|
||||||
// Skip failed initializers
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user