code: def test_logs_out(self):
      import tempfile
  
      with tempfile.NamedTemporaryFile() as tmp:
          env = dict(os.environ)
          env["TORCH_LOGS"] = "dynamo"
          env["TORCH_LOGS_OUT"] = tmp.name
          stdout, stderr = self.run_process_no_exception(
              """\
  import torch
  @torch.compile(backend="eager")
  def fn(a):
      return a.sum()
  
  fn(torch.randn(5))
                  """,
              env=env,
          )
          with open(tmp.name) as fd:
              lines = fd.read()
              self.assertEqual(lines, stderr.decode("utf-8"))
  
imports: import atexit
  import contextlib
  import functools
  import logging
  import os
  import re
  import unittest.mock
  import torch
  import torch._dynamo.test_case
  import torch._dynamo.testing
  import torch.distributed
  from torch._dynamo.testing import skipIfNotPy311
  from torch.nn.parallel import DistributedDataParallel
  from torch.testing._internal.common_utils import find_free_port, munge_exc
  from torch.testing._internal.inductor_utils import HAS_CUDA
  from torch.testing._internal.logging_utils import LoggingTestCase, make_logging_test, make_settings_test
label_desc: Use image node_id 29 for calling the LoggingTests obj's underlying member method code with example usage: obj.test_logs_out() without return types