diff --git a/src/Resources/config/services/services.xml b/src/Resources/config/services/services.xml
index 7b021e49a..4c32a5a86 100644
--- a/src/Resources/config/services/services.xml
+++ b/src/Resources/config/services/services.xml
@@ -10,6 +10,7 @@
%kernel.logs_dir%/mollie_%kernel.environment%.log
14
+ %env(DATABASE_URL)%
diff --git a/src/Service/Logger/MollieLoggerFactory.php b/src/Service/Logger/MollieLoggerFactory.php
index 6bc859447..39d746d99 100644
--- a/src/Service/Logger/MollieLoggerFactory.php
+++ b/src/Service/Logger/MollieLoggerFactory.php
@@ -36,17 +36,24 @@ class MollieLoggerFactory
*/
private $retentionDays;
+ /**
+ * @var string
+ */
+ private $dsn;
+
/**
* @param SettingsService $settingsService
* @param string $filename
* @param string $retentionDays
+ * @param string $dsn
*/
- public function __construct(SettingsService $settingsService, string $filename, string $retentionDays)
+ public function __construct(SettingsService $settingsService, string $filename, string $retentionDays, string $dsn)
{
$this->settingsService = $settingsService;
$this->filename = $filename;
$this->retentionDays = $retentionDays;
+ $this->dsn = $dsn;
}
/**
@@ -54,6 +61,11 @@ public function __construct(SettingsService $settingsService, string $filename,
*/
public function createLogger(): LoggerInterface
{
+ if ($this->dsn === '' || $this->dsn === 'mysql://_placeholder.test') {
+ // deployment server without database
+ return new Logger(self::CHANNEL);
+ }
+
$config = $this->settingsService->getSettings();
# 100 = DEBUG, 200 = INFO