     end) == ""
   end
 
+  @tag timeout: 2_000
   test "capture removal on exit" do
-    handlers = GenEvent.which_handlers(Logger)
-
     {_pid, ref} = spawn_monitor(fn ->
       capture_log(fn ->
         spawn_link(Kernel, :exit, [:shutdown])

      end)
    end)

    # Assert the process is down then invoke capture_io
    # to trigger the ExUnit.Server, ensuring the DOWN
    # message from capture_log has been processed
    assert_receive {:DOWN, ^ref, _, _, :shutdown}
    ExUnit.CaptureIO.capture_io(fn -> "oops" end)

    assert GenEvent.which_handlers(Logger) == handlers
  end

  test "log tracking" do

        refute logged =~ "[warn]  two\n"
    end
  end

  defp wait_capture_removal() do
    case GenEvent.which_handlers(Logger) do
      [Logger.Config] -> :ok
      _otherwise ->
        :timer.sleep(20)
        wait_capture_removal()
    end
  end
end
