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:
2025-08-11 20:13:26 +02:00
parent 59fd3dd3b1
commit 55a330b223
3683 changed files with 2956207 additions and 16948 deletions

View File

@@ -0,0 +1,77 @@
<?php
declare(strict_types=1);
namespace App\Framework\Logging\Commands;
use App\Framework\Console\ConsoleCommand;
use App\Framework\Console\ConsoleInput;
use App\Framework\Console\ConsoleOutput;
use App\Framework\Console\ExitCode;
use App\Framework\Core\ValueObjects\Byte;
use App\Framework\Logging\LogRotator;
final readonly class RotateLogsCommand
{
#[ConsoleCommand(name: "logs:rotate", description: "Rotiert Log-Dateien basierend auf Größe und Anzahl")]
public function execute(ConsoleInput $input, ConsoleOutput $output): int
{
$output->writeLine('<info>Starting log rotation...</info>');
// Standard Log-Pfade
$logPaths = $this->getLogPaths();
$rotator = LogRotator::production();
$rotatedCount = 0;
$totalSize = Byte::zero();
foreach ($logPaths as $name => $path) {
if (! file_exists($path)) {
$output->writeLine("<comment>Skipping {$name}: File not found ({$path})</comment>");
continue;
}
$beforeSize = Byte::fromBytes(filesize($path));
$totalSize = $totalSize->add($beforeSize);
if ($rotator->shouldRotate($path)) {
$output->writeLine("<info>Rotating {$name} ({$path})</info>");
if ($rotator->rotateLog($path)) {
$rotatedCount++;
$output->writeLine("<success> ✓ Successfully rotated {$name}</success>");
// Zeige Rotation-Info
$info = $rotator->getRotationInfo($path);
$output->writeLine(" Current size: {$info['current_size']}");
$output->writeLine(" Rotated files: " . count($info['rotated_files']));
} else {
$output->writeLine("<error> ✗ Failed to rotate {$name}</error>");
}
} else {
$output->writeLine("<comment> → {$name} doesn't need rotation</comment>");
$info = $rotator->getRotationInfo($path);
$output->writeLine(" Current size: {$info['current_size']} / {$info['max_size']}");
}
}
$output->writeLine('');
$output->writeLine("<info>Rotation completed:</info>");
$output->writeLine(" Files rotated: {$rotatedCount}");
$output->writeLine(" Total log size: " . $totalSize->toHumanReadable());
return ExitCode::SUCCESS->value;
}
private function getLogPaths(): array
{
$basePath = $_SERVER['DOCUMENT_ROOT'] ?? '/var/www/html';
return [
'app' => $basePath . '/public/logs/app.log',
'mcp_debug' => $basePath . '/mcp_debug.log',
'framework' => '/tmp/framework.log',
];
}
}