fix(Discovery): Add comprehensive debug logging for router initialization
- Add initializer count logging in DiscoveryServiceBootstrapper - Add route structure analysis in RouterSetup - Add request parameter logging in HttpRouter - Update PHP production config for better OPcache handling - Fix various config and error handling improvements
This commit is contained in:
@@ -48,14 +48,23 @@ final readonly class DiscoveryServiceBootstrapper
|
||||
$currentContext = ExecutionContext::detect();
|
||||
$contextString = $currentContext->getType()->value;
|
||||
|
||||
// TEMPORARY DEBUG LOGGING
|
||||
error_log("🔍 DISCOVERY DEBUG: Context detected = {$contextString}");
|
||||
error_log("🔍 DISCOVERY DEBUG: Source path = " . $pathProvider->getSourcePath());
|
||||
|
||||
// Direkter Cache-Check mit expliziter toArray/fromArray Serialisierung
|
||||
$defaultPaths = [$pathProvider->getSourcePath()];
|
||||
$cacheKey = DiscoveryCacheIdentifiers::fullDiscoveryKey($defaultPaths, $contextString);
|
||||
|
||||
error_log("🔍 DISCOVERY DEBUG: Cache key = {$cacheKey->toString()}");
|
||||
|
||||
|
||||
$cachedItem = $cache->get($cacheKey);
|
||||
|
||||
error_log("🔍 DISCOVERY DEBUG: Cache hit = " . ($cachedItem->isHit ? 'YES' : 'NO'));
|
||||
|
||||
if ($cachedItem->isHit) {
|
||||
error_log("🔍 DISCOVERY DEBUG: Loading from cache...");
|
||||
// Ensure DiscoveryRegistry class is loaded before attempting deserialization
|
||||
if (! class_exists(DiscoveryRegistry::class, true)) {
|
||||
$cachedRegistry = null;
|
||||
@@ -82,6 +91,9 @@ final readonly class DiscoveryServiceBootstrapper
|
||||
}
|
||||
|
||||
if ($cachedRegistry !== null && ! $cachedRegistry->isEmpty()) {
|
||||
$routeCount = count($cachedRegistry->attributes->get(\App\Framework\Attributes\Route::class));
|
||||
error_log("🔍 DISCOVERY DEBUG: Cached registry loaded - Route count: {$routeCount}");
|
||||
|
||||
$this->container->singleton(DiscoveryRegistry::class, $cachedRegistry);
|
||||
|
||||
// Process DefaultImplementation attributes first (before Initializers)
|
||||
@@ -97,10 +109,18 @@ final readonly class DiscoveryServiceBootstrapper
|
||||
}
|
||||
|
||||
// Fallback: Vollständige Discovery durchführen
|
||||
error_log("🔍 DISCOVERY DEBUG: Performing fresh discovery...");
|
||||
$results = $this->performBootstrap($pathProvider, $cache, $discoveryConfig);
|
||||
error_log("🔍 DISCOVERY DEBUG: Discovery completed - isEmpty: " . ($results->isEmpty() ? 'YES' : 'NO'));
|
||||
|
||||
// Nach der Discovery explizit in unserem eigenen Cache-Format speichern
|
||||
$consoleCommandCount = count($results->attributes->get(\App\Framework\Console\ConsoleCommand::class));
|
||||
$routeCount = count($results->attributes->get(\App\Framework\Attributes\Route::class));
|
||||
$initializerCount = count($results->attributes->get(\App\Framework\DI\Initializer::class));
|
||||
|
||||
error_log("🔍 DISCOVERY DEBUG: Found {$routeCount} routes");
|
||||
error_log("🔍 DISCOVERY DEBUG: Found {$consoleCommandCount} console commands");
|
||||
error_log("🔍 DISCOVERY DEBUG: Found {$initializerCount} initializers");
|
||||
|
||||
// Only cache if we found meaningful results
|
||||
// An empty discovery likely indicates initialization timing issues
|
||||
|
||||
Reference in New Issue
Block a user