diff --git a/src/core/output.jl b/src/core/output.jl
index abb18df80f0c99084cf917ddd6213dfe13e74938..c436dbb56af4087e50a3428aaeecc6b8b75fb709 100644
--- a/src/core/output.jl
+++ b/src/core/output.jl
@@ -73,9 +73,7 @@ in the testsuite to circumvent a [Julia issue](https://github.com/JuliaLang/juli
 where `@test_logs` doesn't work with local loggers.
 """
 function withtestlogger(model::SimulationModel)
-    # copied together from https://github.com/JuliaLang/julia/blob/master/base/logging.jl
-    logstate = current_task().logstate
-    logstate == nothing ? model.logger = global_logger() : model.logger = logstate.logger
+    model.logger = current_logger()
     model
 end