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:
102
tests/Framework/Logging/test_logging.php
Normal file
102
tests/Framework/Logging/test_logging.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once __DIR__ . '/../../../vendor/autoload.php';
|
||||
|
||||
use App\Framework\Config\TypedConfiguration;
|
||||
use App\Framework\Core\PathProvider;
|
||||
use App\Framework\Logging\LogConfig;
|
||||
use App\Framework\Logging\LoggerInitializer;
|
||||
use App\Framework\Logging\LogViewerInitializer;
|
||||
|
||||
// Basispfad für Tests
|
||||
$basePath = dirname(__DIR__, 3);
|
||||
|
||||
// PathProvider initialisieren
|
||||
$pathProvider = new PathProvider($basePath);
|
||||
|
||||
// Konfiguration für Tests
|
||||
$_ENV['LOG_BASE_PATH'] = 'logs';
|
||||
|
||||
echo "=== Logging-Test ===\n";
|
||||
|
||||
// LogConfig testen
|
||||
echo "\n1. LogConfig testen...\n";
|
||||
$logConfig = new LogConfig($pathProvider);
|
||||
$logConfig->ensureLogDirectoriesExist();
|
||||
|
||||
$logPaths = $logConfig->getAllLogPaths();
|
||||
echo "Konfigurierte Logpfade:\n";
|
||||
foreach ($logPaths as $type => $path) {
|
||||
echo "- $type: $path\n";
|
||||
|
||||
// Prüfen, ob das Verzeichnis existiert
|
||||
$dir = dirname($path);
|
||||
if (file_exists($dir)) {
|
||||
echo " ✓ Verzeichnis existiert\n";
|
||||
} else {
|
||||
echo " ✗ Verzeichnis existiert nicht!\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Logger testen
|
||||
echo "\n2. Logger testen...\n";
|
||||
|
||||
// Mock TypedConfiguration
|
||||
$config = new class () {
|
||||
public $app;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->app = new class () {
|
||||
public function isDebugEnabled(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function isProduction(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
// Logger initialisieren
|
||||
$loggerInitializer = new LoggerInitializer();
|
||||
$logger = $loggerInitializer($config, $pathProvider);
|
||||
|
||||
// Testlogs schreiben
|
||||
echo "Testlogs schreiben...\n";
|
||||
$logger->debug("Debug-Testmeldung");
|
||||
$logger->info("Info-Testmeldung");
|
||||
$logger->warning("Warning-Testmeldung");
|
||||
$logger->error("Error-Testmeldung");
|
||||
|
||||
// Prüfen, ob Logs geschrieben wurden
|
||||
$appLogPath = $logConfig->getLogPath('app');
|
||||
echo "Prüfe Log-Datei: $appLogPath\n";
|
||||
if (file_exists($appLogPath)) {
|
||||
echo "✓ Log-Datei existiert\n";
|
||||
$logContent = file_get_contents($appLogPath);
|
||||
echo "Inhalt der Log-Datei:\n";
|
||||
echo "---\n";
|
||||
echo $logContent;
|
||||
echo "---\n";
|
||||
} else {
|
||||
echo "✗ Log-Datei existiert nicht!\n";
|
||||
}
|
||||
|
||||
// LogViewer testen
|
||||
echo "\n3. LogViewer testen...\n";
|
||||
$logViewerInitializer = new LogViewerInitializer();
|
||||
$logViewer = $logViewerInitializer($pathProvider);
|
||||
|
||||
$availableLogs = $logViewer->getAvailableLogs();
|
||||
echo "Verfügbare Logs:\n";
|
||||
foreach ($availableLogs as $type => $path) {
|
||||
echo "- $type: $path\n";
|
||||
}
|
||||
|
||||
echo "\nTest abgeschlossen.\n";
|
||||
Reference in New Issue
Block a user