Skip to content

Commit 7cf794f

Browse files
committed
Do not auto-add console logger when one already exists
1 parent 6684880 commit 7cf794f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/rails_semantic_logger/engine.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,8 @@ class Engine < ::Rails::Engine
221221
console do |_app|
222222
# Don't use a background thread for logging
223223
SemanticLogger.sync!
224-
if config.rails_semantic_logger.console_logger
224+
# Add a stderr logger when running inside a Rails console unless one has already been added.
225+
if config.rails_semantic_logger.console_logger && !SemanticLogger::Logger.processor.appenders.console_output?
225226
SemanticLogger.add_appender(io: STDERR, formatter: :color)
226227
end
227228

0 commit comments

Comments
 (0)