diff --git a/src/Appwrite/Platform/Workers/Certificates.php b/src/Appwrite/Platform/Workers/Certificates.php index 3a65dfed2b..73447b5515 100644 --- a/src/Appwrite/Platform/Workers/Certificates.php +++ b/src/Appwrite/Platform/Workers/Certificates.php @@ -174,6 +174,9 @@ class Certificates extends Action $success = false; try { + $date = \date('H:i:s'); + $certificate->setAttribute('logs', "\033[90m[{$date}] \033[97mCertificate generation started. \033[0m\n"); + // Validate domain and DNS records. Skip if job is forced if (!$skipRenewCheck) { $mainDomain = $validationDomain ?? $this->getMainDomain(); @@ -201,9 +204,11 @@ class Certificates extends Action $success = true; } catch (Throwable $e) { $logs = $e->getMessage(); + $currentLogs = $certificate->getAttribute('logs', ''); + $date = \date('H:i:s'); + $errorMessage = "\033[90m[{$date}] \033[31mCertificate generation failed: \033[0m\n"; - // Set exception as log in certificate document - $certificate->setAttribute('logs', \mb_strcut($logs, 0, 1000000));// Limit to 1MB + $certificate->setAttribute('logs', $currentLogs . $errorMessage . \mb_strcut($logs, 0, 500000));// Limit to 500kb // Increase attempts count $attempts = $certificate->getAttribute('attempts', 0) + 1;