code: def construct_log_settings(env):
      templates = [
          "-Dlog.file=${flink_log_dir}/flink-${flink_ident_string}-python-${hostname}.log",
          "-Dlog4j.configuration=${log4j_properties}",
          "-Dlog4j.configurationFile=${log4j_properties}",
          "-Dlogback.configurationFile=${logback_xml}",
      ]
  
      flink_home = os.path.realpath(_find_flink_home())
      flink_conf_dir = env["FLINK_CONF_DIR"]
      flink_conf_file = os.path.join(
          env["FLINK_CONF_DIR"], "flink-conf.yaml"
      )
  
      if "FLINK_LOG_DIR" in env:
          flink_log_dir = env["FLINK_LOG_DIR"]
      else:
          flink_log_dir = read_from_config(
              KEY_ENV_LOG_DIR,
              os.path.join(flink_home, "log"),
              flink_conf_file,
          )
  
      if "LOG4J_PROPERTIES" in env:
          log4j_properties = env["LOG4J_PROPERTIES"]
      else:
          log4j_properties = "%s/log4j-cli.properties" % flink_conf_dir
  
      if "LOGBACK_XML" in env:
          logback_xml = env["LOGBACK_XML"]
      else:
          logback_xml = "%s/logback.xml" % flink_conf_dir
  
      if "FLINK_IDENT_STRING" in env:
          flink_ident_string = env["FLINK_IDENT_STRING"]
      else:
          flink_ident_string = getpass.getuser()
  
      hostname = socket.gethostname()
      log_settings = []
      for template in templates:
          log_settings.append(
              Template(template).substitute(
                  log4j_properties=log4j_properties,
                  logback_xml=logback_xml,
                  flink_log_dir=flink_log_dir,
                  flink_ident_string=flink_ident_string,
                  hostname=hostname,
              )
          )
      return log_settings
  
imports: import argparse
  import getpass
  import glob
  import os
  import platform
  import signal
  import socket
  import sys
  from collections import namedtuple
  from string import Template
  from subprocess import Popen, PIPE
  from pyflink.find_flink_home import _find_flink_home, _find_flink_source_root
label_desc: Use image node_id 5 for calling a global function with example usage: construct_log_settings(env) and returns: log_settings