docstr: Test serve.run logging API
code: def test_encoding(self, serve_and_ray_shutdown, encoding_type):
      """Test serve.run logging API"""
      logging_config = {"encoding": encoding_type}
      logger = logging.getLogger("ray.serve")
  
      @serve.deployment(logging_config=logging_config)
      class Model:
          def __call__(self, req: starlette.requests.Request):
              return {
                  "log_file": logger.handlers[1].baseFilename,
                  "replica": serve.get_replica_context().replica_tag,
              }
  
      serve.run(Model.bind())
      resp = requests.get("http://127.0.0.1:8000/").json()
  
      replica_id = resp["replica"].split("#")[-1]
      if encoding_type == "JSON":
          expected_log_regex = [f'"replica": "{replica_id}", ']
      else:
          expected_log_regex = [f".*{replica_id}.*"]
      check_log_file(resp["log_file"], expected_log_regex)
  
imports: import io
  import json
  import logging
  import os
  import re
  import string
  import sys
  import time
  from contextlib import redirect_stderr
  import pytest
  import requests
  import starlette
  import ray
  import ray.util.state
  from ray import serve
  from ray._private.test_utils import wait_for_condition
  from ray.serve._private.common import ServeComponentType
  from ray.serve._private.constants import SERVE_LOG_EXTRA_FIELDS
  from ray.serve._private.logging_utils import ServeJSONFormatter, get_component_log_file_name, get_serve_logs_dir
label_desc: Use image node_id 2 for calling the TestLoggingAPI obj's underlying member method code with example usage: obj.test_encoding(serve_and_ray_shutdown, encoding_type) and returns: dict