diff --git a/src/core/output.jl b/src/core/output.jl
index 4b3fd9712dba0b15a4d3bc97c324446368522479..3f404ec51fbf9fee0f7b756fcc367db02af7dfde 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