diff --git a/UPGRADE.md b/UPGRADE.md
index a0e21d83d8d..e51562bd0ab 100644
--- a/UPGRADE.md
+++ b/UPGRADE.md
@@ -8,6 +8,11 @@ awareness about deprecated code.
# Upgrade to 3.2
+## Deprecated `SQLLogger` and its implementations.
+
+The `SQLLogger` and its implementations `DebugStack` and `LoggerChain` have been deprecated.
+For logging purposes, use `Doctrine\DBAL\Logging\Middleware` instead. No replacement for `DebugStack` is provided.
+
## Deprecated `SqliteSchemaManager::createDatabase()` and `dropDatabase()` methods.
The `SqliteSchemaManager::createDatabase()` and `dropDatabase()` methods have been deprecated. The SQLite engine
diff --git a/psalm.xml.dist b/psalm.xml.dist
index eb1afaf6ba6..4b194dda9f3 100644
--- a/psalm.xml.dist
+++ b/psalm.xml.dist
@@ -67,6 +67,13 @@
TODO: remove in 4.0.0
-->
+
+
+
+
@@ -80,6 +87,11 @@
TODO: remove in 4.0.0
-->
+
+
diff --git a/src/Logging/DebugStack.php b/src/Logging/DebugStack.php
index 6a9fab5a9e4..24a2d68cfbe 100644
--- a/src/Logging/DebugStack.php
+++ b/src/Logging/DebugStack.php
@@ -2,10 +2,14 @@
namespace Doctrine\DBAL\Logging;
+use Doctrine\Deprecations\Deprecation;
+
use function microtime;
/**
* Includes executed SQLs in a Debug Stack.
+ *
+ * @deprecated
*/
class DebugStack implements SQLLogger
{
@@ -29,6 +33,15 @@ class DebugStack implements SQLLogger
/** @var int */
public $currentQuery = 0;
+ public function __construct()
+ {
+ Deprecation::trigger(
+ 'doctrine/dbal',
+ 'https://github.com/doctrine/dbal/pull/4967',
+ 'DebugStack is deprecated.'
+ );
+ }
+
/**
* {@inheritdoc}
*/
diff --git a/src/Logging/LoggerChain.php b/src/Logging/LoggerChain.php
index 9b44dc0e3e8..c256dd72cd6 100644
--- a/src/Logging/LoggerChain.php
+++ b/src/Logging/LoggerChain.php
@@ -2,8 +2,12 @@
namespace Doctrine\DBAL\Logging;
+use Doctrine\Deprecations\Deprecation;
+
/**
* Chains multiple SQLLogger.
+ *
+ * @deprecated
*/
class LoggerChain implements SQLLogger
{
@@ -15,6 +19,12 @@ class LoggerChain implements SQLLogger
*/
public function __construct(iterable $loggers = [])
{
+ Deprecation::trigger(
+ 'doctrine/dbal',
+ 'https://github.com/doctrine/dbal/pull/4967',
+ 'LoggerChain is deprecated'
+ );
+
$this->loggers = $loggers;
}
diff --git a/src/Logging/SQLLogger.php b/src/Logging/SQLLogger.php
index a0bdf1bf6a8..40eb707addd 100644
--- a/src/Logging/SQLLogger.php
+++ b/src/Logging/SQLLogger.php
@@ -6,6 +6,9 @@
/**
* Interface for SQL loggers.
+ *
+ * @deprecated Use {@link \Doctrine\DBAL\Logging\Middleware} or implement
+ * {@link \Doctrine\DBAL\Driver\Middleware} instead.
*/
interface SQLLogger
{