Enable Discovery debug logging for production troubleshooting
- Add DISCOVERY_LOG_LEVEL=debug - Add DISCOVERY_SHOW_PROGRESS=true - Temporary changes for debugging InitializerProcessor fixes on production
This commit is contained in:
66
tests/debug/test-initializers.php
Normal file
66
tests/debug/test-initializers.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
use App\Framework\Cache\Driver\InMemoryCache;
|
||||
use App\Framework\Cache\GeneralCache;
|
||||
use App\Framework\Core\PathProvider;
|
||||
use App\Framework\DateTime\SystemClock;
|
||||
use App\Framework\DI\DefaultContainer;
|
||||
use App\Framework\Discovery\Factory\DiscoveryServiceFactory;
|
||||
use App\Framework\Serializer\Json\JsonSerializer;
|
||||
|
||||
try {
|
||||
echo "=== Initializer Discovery Test ===\n";
|
||||
|
||||
// Create basic dependencies
|
||||
$container = new DefaultContainer();
|
||||
$clock = new SystemClock();
|
||||
$pathProvider = new PathProvider('/var/www/html');
|
||||
|
||||
// Create simple cache
|
||||
$cacheDriver = new InMemoryCache();
|
||||
$serializer = new JsonSerializer();
|
||||
$cache = new GeneralCache($cacheDriver, $serializer);
|
||||
|
||||
// Create discovery factory
|
||||
$factory = new DiscoveryServiceFactory($container, $pathProvider, $cache, $clock);
|
||||
|
||||
// Create discovery service for development
|
||||
$discoveryService = $factory->createForDevelopment();
|
||||
|
||||
// Run discovery
|
||||
$registry = $discoveryService->discover();
|
||||
|
||||
$initializers = $registry->attributes->get('App\\Framework\\DI\\Initializer');
|
||||
echo 'Initializers found: ' . count($initializers) . "\n";
|
||||
|
||||
foreach ($initializers as $init) {
|
||||
echo ' - ' . $init->class->getFullyQualified() . '::' . ($init->method ? $init->method->toString() : 'class') . "\n";
|
||||
if ($init->mappedData) {
|
||||
echo ' Data: ' . json_encode($init->mappedData) . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Check if CacheInitializer is specifically found
|
||||
$cacheInitializerFound = false;
|
||||
foreach ($initializers as $init) {
|
||||
if (str_contains($init->class->getFullyQualified(), 'CacheInitializer')) {
|
||||
$cacheInitializerFound = true;
|
||||
echo "\n✅ CacheInitializer found!\n";
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $cacheInitializerFound) {
|
||||
echo "\n❌ CacheInitializer NOT found!\n";
|
||||
}
|
||||
|
||||
} catch (\Throwable $e) {
|
||||
echo "ERROR: " . $e->getMessage() . "\n";
|
||||
echo "File: " . $e->getFile() . ":" . $e->getLine() . "\n";
|
||||
echo "Trace:\n" . $e->getTraceAsString() . "\n";
|
||||
}
|
||||
Reference in New Issue
Block a user