From 0b1712c87e1b7de74730f4abaf41e0a78b7a2101 Mon Sep 17 00:00:00 2001 From: Khushboo Verma Date: Thu, 4 Sep 2025 18:23:40 +0530 Subject: [PATCH 1/2] Add colors to certificate logs --- src/Appwrite/Platform/Workers/Certificates.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Certificates.php b/src/Appwrite/Platform/Workers/Certificates.php index 2138e440b6..aa6471dc1f 100644 --- a/src/Appwrite/Platform/Workers/Certificates.php +++ b/src/Appwrite/Platform/Workers/Certificates.php @@ -171,6 +171,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 = $this->getMainDomain(); @@ -198,9 +201,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, 1000000));// Limit to 1MB // Increase attempts count $attempts = $certificate->getAttribute('attempts', 0) + 1; From a48007d548caa792124c1ca994e01174219a524a Mon Sep 17 00:00:00 2001 From: Khushboo Verma Date: Thu, 11 Sep 2025 15:40:29 +0530 Subject: [PATCH 2/2] Update src/Appwrite/Platform/Workers/Certificates.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Matej Bačo --- src/Appwrite/Platform/Workers/Certificates.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Workers/Certificates.php b/src/Appwrite/Platform/Workers/Certificates.php index 815da7c66d..73447b5515 100644 --- a/src/Appwrite/Platform/Workers/Certificates.php +++ b/src/Appwrite/Platform/Workers/Certificates.php @@ -208,7 +208,7 @@ class Certificates extends Action $date = \date('H:i:s'); $errorMessage = "\033[90m[{$date}] \033[31mCertificate generation failed: \033[0m\n"; - $certificate->setAttribute('logs', $currentLogs . $errorMessage . \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;