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:
@@ -24,6 +24,8 @@ final readonly class HttpRouter implements Router
|
||||
$host = $request->server->getHttpHost();
|
||||
$subdomain = $this->extractSubdomain($host);
|
||||
|
||||
error_log("🔍 ROUTER DEBUG: Host={$host}, Subdomain=" . ($subdomain ?: 'NONE') . ", Path={$path}, Method={$method->value}");
|
||||
|
||||
// 1. Try subdomain-specific routes first
|
||||
if ($subdomain) {
|
||||
$subdomainKey = 'exact:' . $subdomain;
|
||||
|
||||
@@ -35,12 +35,39 @@ final readonly class RouterSetup
|
||||
#$routeCache = new RouteCache($this->pathProvider->getCachePath('routes.cache.php'));
|
||||
|
||||
$routeCount = $this->results->attributes->getCount(Route::class);
|
||||
error_log("🚦 ROUTER SETUP: Route count from discovery = {$routeCount}");
|
||||
|
||||
if ($routeCount > 0) {
|
||||
$discoveredRoutes = $this->results->attributes->get(Route::class);
|
||||
|
||||
// Direct DiscoveredAttribute API
|
||||
$optimizedRoutes = $this->routeCompiler->compileOptimized(...$discoveredRoutes);
|
||||
error_log("🚦 ROUTER SETUP: About to compile routes");
|
||||
try {
|
||||
$optimizedRoutes = $this->routeCompiler->compileOptimized(...$discoveredRoutes);
|
||||
error_log("🚦 ROUTER SETUP: Routes compiled successfully");
|
||||
} catch (\Throwable $e) {
|
||||
error_log("🚦 ROUTER SETUP: ERROR compiling routes: " . $e->getMessage());
|
||||
error_log("🚦 ROUTER SETUP: Exception trace: " . $e->getTraceAsString());
|
||||
throw $e;
|
||||
}
|
||||
|
||||
// DEBUG: Log available static routes structure
|
||||
error_log("🚦 ROUTER SETUP: About to analyze route structure");
|
||||
$staticRoutes = $optimizedRoutes->getStaticRoutes();
|
||||
error_log("🚦 ROUTER SETUP: HTTP Methods count = " . count($staticRoutes));
|
||||
|
||||
// Check GET method subdomain keys
|
||||
$getSubdomainKeys = $optimizedRoutes->getSubdomainKeys(\App\Framework\Http\Method::GET);
|
||||
error_log("🚦 ROUTER SETUP: GET method has subdomain keys: " . json_encode($getSubdomainKeys));
|
||||
|
||||
// Log routes per subdomain for GET
|
||||
foreach ($getSubdomainKeys as $subdomainKey) {
|
||||
$routes = $optimizedRoutes->getStaticRoutesForSubdomain(\App\Framework\Http\Method::GET, $subdomainKey);
|
||||
error_log("🚦 ROUTER SETUP: GET subdomain '{$subdomainKey}' has " . count($routes) . " routes");
|
||||
foreach ($routes as $path => $route) {
|
||||
error_log("🚦 ROUTER SETUP: - {$path}");
|
||||
}
|
||||
}
|
||||
|
||||
// Cache speichern
|
||||
#$routeCache->save($optimizedRoutes);
|
||||
|
||||
Reference in New Issue
Block a user