prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Add console log to prediction
  **Is your feature request related to a problem? Please describe.**
  When running bentoml in a docker container, request logs are not printed to standard out.
  
  **Describe the solution you'd like**
  In a [slack discussion](https://bentoml.slack.com/archives/CKRANBHPH/p1597270160005700), the consensus is to add the console log to prediction by default. One potential solution is to add `console` to the prediction's [handler list](https://github.com/bentoml/BentoML/blob/master/bentoml/utils/log.py#L90).
  
  **Describe alternatives you've considered**
  It was suggested to us to use the existing log files from the workers. But, this introduces complication where we have to mount the log folder in container to the host so that datadog agent may have access to the log and forward it to datadog. Also, we will need to take care of log rotation so that it doesn't grow big. If we have many bentoml services, we have to do this for each of them. 
  
  **Additional context**
  The standard out logging is important for our application monitoring such as Datadog. The standard out logging allows the datadog agent to pick up the log messages and forward them to datadog.
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `bentoml/utils/log.py`
  Content:
  ```
  1 # Copyright 2019 Atalaya Tech, Inc.
  2 
  3 # Licensed under the Apache License, Version 2.0 (the "License");
  4 # you may not use this file except in compliance with the License.
  5 # You may obtain a copy of the License at
  6 
  7 # http://www.apache.org/licenses/LICENSE-2.0
  8 
  9 # Unless required by applicable law or agreed to in writing, software
  10 # distributed under the License is distributed on an "AS IS" BASIS,
  11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12 # See the License for the specific language governing permissions and
  13 # limitations under the License.
  14 
  15 import os
  16 import sys
  17 import logging.config
  18 from pathlib import Path
  19 
  20 from bentoml import config
  21 from bentoml.configuration import get_debug_mode
  22 
  23 
  24 def get_logging_config_dict(logging_level, base_log_directory):
  25     conf = config("logging")  # proxy to logging section in bentoml config file
  26 
  27     LOG_FORMAT = conf.get("LOG_FORMAT")
  28     DEV_LOG_FORMAT = conf.get("DEV_LOG_FORMAT")
  29 
  30     PREDICTION_LOG_FILENAME = conf.get("prediction_log_filename")
  31     PREDICTION_LOG_JSON_FORMAT = conf.get("prediction_log_json_format")
  32 
  33     FEEDBACK_LOG_FILENAME = conf.get("feedback_log_filename")
  34     FEEDBACK_LOG_JSON_FORMAT = conf.get("feedback_log_json_format")
  35 
  36     return {
  37         "version": 1,
  38         "disable_existing_loggers": False,
  39         "formatters": {
  40             "console": {"format": LOG_FORMAT},
  41             "dev": {"format": DEV_LOG_FORMAT},
  42             "prediction": {
  43                 "()": "pythonjsonlogger.jsonlogger.JsonFormatter",
  44                 "fmt": PREDICTION_LOG_JSON_FORMAT,
  45             },
  46             "feedback": {
  47                 "()": "pythonjsonlogger.jsonlogger.JsonFormatter",
  48                 "fmt": FEEDBACK_LOG_JSON_FORMAT,
  49             },
  50         },
  51         "handlers": {
  52             "console": {
  53                 "level": logging_level,
  54                 "formatter": "console",
  55                 "class": "logging.StreamHandler",
  56                 "stream": sys.stdout,
  57             },
  58             "local": {
  59                 "level": logging_level,
  60                 "formatter": "dev",
  61                 "class": "logging.handlers.RotatingFileHandler",
  62                 "filename": os.path.join(base_log_directory, "active.log"),
  63                 "maxBytes": 100 * 1000 * 1000,
  64                 "backupCount": 2,
  65             },
  66             "prediction": {
  67                 "class": "logging.handlers.RotatingFileHandler",
  68                 "formatter": "prediction",
  69                 "level": "INFO",
  70                 "filename": os.path.join(base_log_directory, PREDICTION_LOG_FILENAME),
  71                 "maxBytes": 100 * 1000 * 1000,
  72                 "backupCount": 10,
  73             },
  74             "feedback": {
  75                 "class": "logging.handlers.RotatingFileHandler",
  76                 "formatter": "feedback",
  77                 "level": "INFO",
  78                 "filename": os.path.join(base_log_directory, FEEDBACK_LOG_FILENAME),
  79                 "maxBytes": 100 * 1000 * 1000,
  80                 "backupCount": 10,
  81             },
  82         },
  83         "loggers": {
  84             "bentoml": {
  85                 "handlers": ["console", "local"],
  86                 "level": logging_level,
  87                 "propagate": False,
  88             },
  89             "bentoml.prediction": {
  90                 "handlers": ["prediction"],
  91                 "level": "INFO",
  92                 "propagate": False,
  93             },
  94             "bentoml.feedback": {
  95                 "handlers": ["feedback"],
  96                 "level": "INFO",
  97                 "propagate": False,
  98             },
  99         },
  100     }
  101 
  102 
  103 def configure_logging(logging_level=None):
  104     if logging_level is None:
  105         logging_level = config("logging").get("LOGGING_LEVEL").upper()
  106     if get_debug_mode():
  107         logging_level = logging.getLevelName(logging.DEBUG)
  108 
  109     base_log_dir = os.path.expanduser(config("logging").get("BASE_LOG_DIR"))
  110     Path(base_log_dir).mkdir(parents=True, exist_ok=True)
  111     logging_config = get_logging_config_dict(logging_level, base_log_dir)
  112     logging.config.dictConfig(logging_config)
  113
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/bentoml/utils/log.py b/bentoml/utils/log.py
  --- a/bentoml/utils/log.py
  +++ b/bentoml/utils/log.py
  @@ -87,12 +87,12 @@
                   "propagate": False,
               },
               "bentoml.prediction": {
  -                "handlers": ["prediction"],
  +                "handlers": ["prediction", "console"],
                   "level": "INFO",
                   "propagate": False,
               },
               "bentoml.feedback": {
  -                "handlers": ["feedback"],
  +                "handlers": ["feedback", "console"],
                   "level": "INFO",
                   "propagate": False,
               },
  
verification_info: {"golden_diff": "diff --git a/bentoml/utils/log.py b/bentoml/utils/log.py\n--- a/bentoml/utils/log.py\n+++ b/bentoml/utils/log.py\n@@ -87,12 +87,12 @@\n                 \"propagate\": False,\n             },\n             \"bentoml.prediction\": {\n-                \"handlers\": [\"prediction\"],\n+                \"handlers\": [\"prediction\", \"console\"],\n                 \"level\": \"INFO\",\n                 \"propagate\": False,\n             },\n             \"bentoml.feedback\": {\n-                \"handlers\": [\"feedback\"],\n+                \"handlers\": [\"feedback\", \"console\"],\n                 \"level\": \"INFO\",\n                 \"propagate\": False,\n             },\n", "issue": "Add console log to prediction\n**Is your feature request related to a problem? Please describe.**\r\nWhen running bentoml in a docker container, request logs are not printed to standard out.\r\n\r\n**Describe the solution you'd like**\r\nIn a [slack discussion](https://bentoml.slack.com/archives/CKRANBHPH/p1597270160005700), the consensus is to add the console log to prediction by default. One potential solution is to add `console` to the prediction's [handler list](https://github.com/bentoml/BentoML/blob/master/bentoml/utils/log.py#L90).\r\n\r\n**Describe alternatives you've considered**\r\nIt was suggested to us to use the existing log files from the workers. But, this introduces complication where we have to mount the log folder in container to the host so that datadog agent may have access to the log and forward it to datadog. Also, we will need to take care of log rotation so that it doesn't grow big. If we have many bentoml services, we have to do this for each of them. \r\n\r\n**Additional context**\r\nThe standard out logging is important for our application monitoring such as Datadog. The standard out logging allows the datadog agent to pick up the log messages and forward them to datadog.\r\n\n", "before_files": [{"content": "# Copyright 2019 Atalaya Tech, Inc.\n\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n\n# http://www.apache.org/licenses/LICENSE-2.0\n\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport os\nimport sys\nimport logging.config\nfrom pathlib import Path\n\nfrom bentoml import config\nfrom bentoml.configuration import get_debug_mode\n\n\ndef get_logging_config_dict(logging_level, base_log_directory):\n    conf = config(\"logging\")  # proxy to logging section in bentoml config file\n\n    LOG_FORMAT = conf.get(\"LOG_FORMAT\")\n    DEV_LOG_FORMAT = conf.get(\"DEV_LOG_FORMAT\")\n\n    PREDICTION_LOG_FILENAME = conf.get(\"prediction_log_filename\")\n    PREDICTION_LOG_JSON_FORMAT = conf.get(\"prediction_log_json_format\")\n\n    FEEDBACK_LOG_FILENAME = conf.get(\"feedback_log_filename\")\n    FEEDBACK_LOG_JSON_FORMAT = conf.get(\"feedback_log_json_format\")\n\n    return {\n        \"version\": 1,\n        \"disable_existing_loggers\": False,\n        \"formatters\": {\n            \"console\": {\"format\": LOG_FORMAT},\n            \"dev\": {\"format\": DEV_LOG_FORMAT},\n            \"prediction\": {\n                \"()\": \"pythonjsonlogger.jsonlogger.JsonFormatter\",\n                \"fmt\": PREDICTION_LOG_JSON_FORMAT,\n            },\n            \"feedback\": {\n                \"()\": \"pythonjsonlogger.jsonlogger.JsonFormatter\",\n                \"fmt\": FEEDBACK_LOG_JSON_FORMAT,\n            },\n        },\n        \"handlers\": {\n            \"console\": {\n                \"level\": logging_level,\n                \"formatter\": \"console\",\n                \"class\": \"logging.StreamHandler\",\n                \"stream\": sys.stdout,\n            },\n            \"local\": {\n                \"level\": logging_level,\n                \"formatter\": \"dev\",\n                \"class\": \"logging.handlers.RotatingFileHandler\",\n                \"filename\": os.path.join(base_log_directory, \"active.log\"),\n                \"maxBytes\": 100 * 1000 * 1000,\n                \"backupCount\": 2,\n            },\n            \"prediction\": {\n                \"class\": \"logging.handlers.RotatingFileHandler\",\n                \"formatter\": \"prediction\",\n                \"level\": \"INFO\",\n                \"filename\": os.path.join(base_log_directory, PREDICTION_LOG_FILENAME),\n                \"maxBytes\": 100 * 1000 * 1000,\n                \"backupCount\": 10,\n            },\n            \"feedback\": {\n                \"class\": \"logging.handlers.RotatingFileHandler\",\n                \"formatter\": \"feedback\",\n                \"level\": \"INFO\",\n                \"filename\": os.path.join(base_log_directory, FEEDBACK_LOG_FILENAME),\n                \"maxBytes\": 100 * 1000 * 1000,\n                \"backupCount\": 10,\n            },\n        },\n        \"loggers\": {\n            \"bentoml\": {\n                \"handlers\": [\"console\", \"local\"],\n                \"level\": logging_level,\n                \"propagate\": False,\n            },\n            \"bentoml.prediction\": {\n                \"handlers\": [\"prediction\"],\n                \"level\": \"INFO\",\n                \"propagate\": False,\n            },\n            \"bentoml.feedback\": {\n                \"handlers\": [\"feedback\"],\n                \"level\": \"INFO\",\n                \"propagate\": False,\n            },\n        },\n    }\n\n\ndef configure_logging(logging_level=None):\n    if logging_level is None:\n        logging_level = config(\"logging\").get(\"LOGGING_LEVEL\").upper()\n    if get_debug_mode():\n        logging_level = logging.getLevelName(logging.DEBUG)\n\n    base_log_dir = os.path.expanduser(config(\"logging\").get(\"BASE_LOG_DIR\"))\n    Path(base_log_dir).mkdir(parents=True, exist_ok=True)\n    logging_config = get_logging_config_dict(logging_level, base_log_dir)\n    logging.config.dictConfig(logging_config)\n", "path": "bentoml/utils/log.py"}], "after_files": [{"content": "# Copyright 2019 Atalaya Tech, Inc.\n\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n\n# http://www.apache.org/licenses/LICENSE-2.0\n\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport os\nimport sys\nimport logging.config\nfrom pathlib import Path\n\nfrom bentoml import config\nfrom bentoml.configuration import get_debug_mode\n\n\ndef get_logging_config_dict(logging_level, base_log_directory):\n    conf = config(\"logging\")  # proxy to logging section in bentoml config file\n\n    LOG_FORMAT = conf.get(\"LOG_FORMAT\")\n    DEV_LOG_FORMAT = conf.get(\"DEV_LOG_FORMAT\")\n\n    PREDICTION_LOG_FILENAME = conf.get(\"prediction_log_filename\")\n    PREDICTION_LOG_JSON_FORMAT = conf.get(\"prediction_log_json_format\")\n\n    FEEDBACK_LOG_FILENAME = conf.get(\"feedback_log_filename\")\n    FEEDBACK_LOG_JSON_FORMAT = conf.get(\"feedback_log_json_format\")\n\n    return {\n        \"version\": 1,\n        \"disable_existing_loggers\": False,\n        \"formatters\": {\n            \"console\": {\"format\": LOG_FORMAT},\n            \"dev\": {\"format\": DEV_LOG_FORMAT},\n            \"prediction\": {\n                \"()\": \"pythonjsonlogger.jsonlogger.JsonFormatter\",\n                \"fmt\": PREDICTION_LOG_JSON_FORMAT,\n            },\n            \"feedback\": {\n                \"()\": \"pythonjsonlogger.jsonlogger.JsonFormatter\",\n                \"fmt\": FEEDBACK_LOG_JSON_FORMAT,\n            },\n        },\n        \"handlers\": {\n            \"console\": {\n                \"level\": logging_level,\n                \"formatter\": \"console\",\n                \"class\": \"logging.StreamHandler\",\n                \"stream\": sys.stdout,\n            },\n            \"local\": {\n                \"level\": logging_level,\n                \"formatter\": \"dev\",\n                \"class\": \"logging.handlers.RotatingFileHandler\",\n                \"filename\": os.path.join(base_log_directory, \"active.log\"),\n                \"maxBytes\": 100 * 1000 * 1000,\n                \"backupCount\": 2,\n            },\n            \"prediction\": {\n                \"class\": \"logging.handlers.RotatingFileHandler\",\n                \"formatter\": \"prediction\",\n                \"level\": \"INFO\",\n                \"filename\": os.path.join(base_log_directory, PREDICTION_LOG_FILENAME),\n                \"maxBytes\": 100 * 1000 * 1000,\n                \"backupCount\": 10,\n            },\n            \"feedback\": {\n                \"class\": \"logging.handlers.RotatingFileHandler\",\n                \"formatter\": \"feedback\",\n                \"level\": \"INFO\",\n                \"filename\": os.path.join(base_log_directory, FEEDBACK_LOG_FILENAME),\n                \"maxBytes\": 100 * 1000 * 1000,\n                \"backupCount\": 10,\n            },\n        },\n        \"loggers\": {\n            \"bentoml\": {\n                \"handlers\": [\"console\", \"local\"],\n                \"level\": logging_level,\n                \"propagate\": False,\n            },\n            \"bentoml.prediction\": {\n                \"handlers\": [\"prediction\", \"console\"],\n                \"level\": \"INFO\",\n                \"propagate\": False,\n            },\n            \"bentoml.feedback\": {\n                \"handlers\": [\"feedback\", \"console\"],\n                \"level\": \"INFO\",\n                \"propagate\": False,\n            },\n        },\n    }\n\n\ndef configure_logging(logging_level=None):\n    if logging_level is None:\n        logging_level = config(\"logging\").get(\"LOGGING_LEVEL\").upper()\n    if get_debug_mode():\n        logging_level = logging.getLevelName(logging.DEBUG)\n\n    base_log_dir = os.path.expanduser(config(\"logging\").get(\"BASE_LOG_DIR\"))\n    Path(base_log_dir).mkdir(parents=True, exist_ok=True)\n    logging_config = get_logging_config_dict(logging_level, base_log_dir)\n    logging.config.dictConfig(logging_config)\n", "path": "bentoml/utils/log.py"}]}