Log-Viewer aktualisiert

This commit is contained in:
blaerf 2025-12-17 16:06:10 +01:00
parent 52223ba1e8
commit c01d8b9b12
2 changed files with 36 additions and 2 deletions

View File

@ -135,7 +135,24 @@ exec($cmd . ' 2>&1', $output, $returnVar);
$json = implode("\n", $output); $json = implode("\n", $output);
// Optional: write raw output into logs for debugging // Optional: write raw output into logs for debugging
@file_put_contents(__DIR__ . '/../logs/create_user_output.log', date('Y-m-d H:i:s') . ' CMD: ' . $cmd . "\n" . $json . "\n\n", FILE_APPEND | LOCK_EX); $ts = date('Y-m-d H:i:s');
$ctx = [
'cmd' => $cmd,
'return_code' => $returnVar,
'output' => $json,
];
$line = sprintf(
"[%s] %-7s %s %s%s",
$ts,
'DEBUG',
'PowerShell CMD',
json_encode($ctx, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
PHP_EOL
);
@file_put_contents(__DIR__ . '/../logs/create_user_output.log', $line, FILE_APPEND | LOCK_EX);
@unlink($tmpFile); @unlink($tmpFile);

View File

@ -82,7 +82,24 @@ $json = implode("\n", $output);
@unlink($metaFile); @unlink($metaFile);
// Optional: log the CSV script command and raw output to help debugging // Optional: log the CSV script command and raw output to help debugging
@file_put_contents(__DIR__ . '/../logs/create_users_csv_output.log', date('Y-m-d H:i:s') . ' CMD: ' . $cmd . "\n" . $json . "\n\n", FILE_APPEND | LOCK_EX); $ts = date('Y-m-d H:i:s');
$ctx = [
'cmd' => $cmd,
'return_code' => $returnVar,
'output' => $json,
];
$line = sprintf(
"[%s] %-7s %s %s%s",
$ts,
'DEBUG',
'PowerShell CMD',
json_encode($ctx, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
PHP_EOL
);
@file_put_contents(__DIR__ . '/../logs/create_users_csv_output.log', $line, FILE_APPEND | LOCK_EX);
$result = null; $result = null;
if ($json !== '') { if ($json !== '') {