prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Log format is not properly setup for KFServer
  /kind bug
  
  **What steps did you take and what happened:**
  Log format is not properly setup
  
  ```
  INFO:root:Copying contents of /mnt/models to local
  INFO:root:Registering model:cifar10
  INFO:root:Listening on port 8080
  INFO:tornado.general:Starting 40 processes
  INFO:tornado.access:200 POST /v1/models/cifar10:predict (127.0.0.1) 11488.05ms
  INFO:tornado.access:200 POST /v1/models/cifar10:predict (127.0.0.1) 22800.67ms
  INFO:tornado.access:200 POST /v1/models/cifar10:predict (127.0.0.1) 24200.31ms
  INFO:tornado.access:200 POST /v1/models/cifar10:predict (127.0.0.1) 8301.00ms
  INFO:tornado.access:200 POST /v1/models/cifar10:predict (127.0.0.1) 38398.63ms
  INFO:tornado.access:200 POST /v1/models/cifar10:predict (127.0.0.1) 38799.67ms
  INFO:tornado.access:200 POST /v1/models/cifar10:predict (127.0.0.1) 7599.63ms
  INFO:tornado.access:200 POST /v1/models/cifar10:predict (127.0.0.1) 39800.00ms
  INFO:tornado.access:200 POST /v1/models/cifar10:predict (127.0.0.1) 32200.33ms
  ```
  
  **What did you expect to happen:**
  The log format should include timestamp.
  
  **Anything else you would like to add:**
  [Miscellaneous information that will assist in solving the issue.]
  
  
  **Environment:**
  
  - Istio Version:
  - Knative Version:
  - KFServing Version: 0.2.0
  - Kubeflow version:
  - Minikube version:
  - Kubernetes version: (use `kubectl version`):
  - OS (e.g. from `/etc/os-release`):
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `python/kfserving/kfserving/kfserver.py`
  Content:
  ```
  1 # Copyright 2019 kubeflow.org.
  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 tornado.ioloop
  16 import tornado.web
  17 import tornado.httpserver
  18 import argparse
  19 import logging
  20 import json
  21 from typing import List, Dict
  22 from kfserving.handlers.http import PredictHandler, ExplainHandler
  23 from kfserving import KFModel
  24 from kfserving.constants import constants
  25 
  26 DEFAULT_HTTP_PORT = 8080
  27 DEFAULT_GRPC_PORT = 8081
  28 
  29 parser = argparse.ArgumentParser(add_help=False)
  30 parser.add_argument('--http_port', default=DEFAULT_HTTP_PORT, type=int,
  31                     help='The HTTP Port listened to by the model server.')
  32 parser.add_argument('--grpc_port', default=DEFAULT_GRPC_PORT, type=int,
  33                     help='The GRPC Port listened to by the model server.')
  34 parser.add_argument('--workers', default=0, type=int,
  35                     help='The number of works to fork')
  36 args, _ = parser.parse_known_args()
  37 
  38 logging.basicConfig(level=constants.KFSERVING_LOGLEVEL)
  39 
  40 
  41 class KFServer():
  42     def __init__(self, http_port: int = args.http_port,
  43                  grpc_port: int = args.grpc_port,
  44                  workers: int = args.workers):
  45         self.registered_models = {}
  46         self.http_port = http_port
  47         self.grpc_port = grpc_port
  48         self.workers = workers
  49         self._http_server = None
  50 
  51     def create_application(self):
  52         return tornado.web.Application([
  53             # Server Liveness API returns 200 if server is alive.
  54             (r"/", LivenessHandler),
  55             (r"/v1/models",
  56              ListHandler, dict(models=self.registered_models)),
  57             # Model Health API returns 200 if model is ready to serve.
  58             (r"/v1/models/([a-zA-Z0-9_-]+)",
  59              HealthHandler, dict(models=self.registered_models)),
  60             (r"/v1/models/([a-zA-Z0-9_-]+):predict",
  61              PredictHandler, dict(models=self.registered_models)),
  62             (r"/v1/models/([a-zA-Z0-9_-]+):explain",
  63              ExplainHandler, dict(models=self.registered_models)),
  64         ])
  65 
  66     def start(self, models: List[KFModel]):
  67         for model in models:
  68             self.register_model(model)
  69 
  70         self._http_server = tornado.httpserver.HTTPServer(
  71             self.create_application())
  72 
  73         logging.info("Listening on port %s", self.http_port)
  74         self._http_server.bind(self.http_port)
  75         logging.info("Will fork %d workers", self.workers)
  76         self._http_server.start(self.workers)
  77         tornado.ioloop.IOLoop.current().start()
  78 
  79     def register_model(self, model: KFModel):
  80         if not model.name:
  81             raise Exception(
  82                 "Failed to register model, model.name must be provided.")
  83         self.registered_models[model.name] = model
  84         logging.info("Registering model: %s", model.name)
  85 
  86 
  87 class LivenessHandler(tornado.web.RequestHandler):  # pylint:disable=too-few-public-methods
  88     def get(self):
  89         self.write("Alive")
  90 
  91 
  92 class HealthHandler(tornado.web.RequestHandler):
  93     def initialize(self, models: Dict[str, KFModel]):
  94         self.models = models  # pylint:disable=attribute-defined-outside-init
  95 
  96     def get(self, name: str):
  97         if name not in self.models:
  98             raise tornado.web.HTTPError(
  99                 status_code=404,
  100                 reason="Model with name %s does not exist." % name
  101             )
  102 
  103         model = self.models[name]
  104         self.write(json.dumps({
  105             "name": model.name,
  106             "ready": model.ready
  107         }))
  108 
  109 
  110 class ListHandler(tornado.web.RequestHandler):
  111     def initialize(self, models: Dict[str, KFModel]):
  112         self.models = models  # pylint:disable=attribute-defined-outside-init
  113 
  114     def get(self):
  115         self.write(json.dumps(list(self.models.values())))
  116
  ```
  --- 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/python/kfserving/kfserving/kfserver.py b/python/kfserving/kfserving/kfserver.py
  --- a/python/kfserving/kfserving/kfserver.py
  +++ b/python/kfserving/kfserving/kfserver.py
  @@ -12,16 +12,16 @@
   # See the License for the specific language governing permissions and
   # limitations under the License.
   
  -import tornado.ioloop
  -import tornado.web
  -import tornado.httpserver
   import argparse
   import logging
   import json
   from typing import List, Dict
  +import tornado.ioloop
  +import tornado.web
  +import tornado.httpserver
  +import tornado.log
   from kfserving.handlers.http import PredictHandler, ExplainHandler
   from kfserving import KFModel
  -from kfserving.constants import constants
   
   DEFAULT_HTTP_PORT = 8080
   DEFAULT_GRPC_PORT = 8081
  @@ -35,8 +35,7 @@
                       help='The number of works to fork')
   args, _ = parser.parse_known_args()
   
  -logging.basicConfig(level=constants.KFSERVING_LOGLEVEL)
  -
  +tornado.log.enable_pretty_logging()
   
   class KFServer():
       def __init__(self, http_port: int = args.http_port,
  
verification_info: {"golden_diff": "diff --git a/python/kfserving/kfserving/kfserver.py b/python/kfserving/kfserving/kfserver.py\n--- a/python/kfserving/kfserving/kfserver.py\n+++ b/python/kfserving/kfserving/kfserver.py\n@@ -12,16 +12,16 @@\n # See the License for the specific language governing permissions and\n # limitations under the License.\n \n-import tornado.ioloop\n-import tornado.web\n-import tornado.httpserver\n import argparse\n import logging\n import json\n from typing import List, Dict\n+import tornado.ioloop\n+import tornado.web\n+import tornado.httpserver\n+import tornado.log\n from kfserving.handlers.http import PredictHandler, ExplainHandler\n from kfserving import KFModel\n-from kfserving.constants import constants\n \n DEFAULT_HTTP_PORT = 8080\n DEFAULT_GRPC_PORT = 8081\n@@ -35,8 +35,7 @@\n                     help='The number of works to fork')\n args, _ = parser.parse_known_args()\n \n-logging.basicConfig(level=constants.KFSERVING_LOGLEVEL)\n-\n+tornado.log.enable_pretty_logging()\n \n class KFServer():\n     def __init__(self, http_port: int = args.http_port,\n", "issue": "Log format is not properly setup for KFServer\n/kind bug\r\n\r\n**What steps did you take and what happened:**\r\nLog format is not properly setup\r\n\r\n```\r\nINFO:root:Copying contents of /mnt/models to local\r\nINFO:root:Registering model:cifar10\r\nINFO:root:Listening on port 8080\r\nINFO:tornado.general:Starting 40 processes\r\nINFO:tornado.access:200 POST /v1/models/cifar10:predict (127.0.0.1) 11488.05ms\r\nINFO:tornado.access:200 POST /v1/models/cifar10:predict (127.0.0.1) 22800.67ms\r\nINFO:tornado.access:200 POST /v1/models/cifar10:predict (127.0.0.1) 24200.31ms\r\nINFO:tornado.access:200 POST /v1/models/cifar10:predict (127.0.0.1) 8301.00ms\r\nINFO:tornado.access:200 POST /v1/models/cifar10:predict (127.0.0.1) 38398.63ms\r\nINFO:tornado.access:200 POST /v1/models/cifar10:predict (127.0.0.1) 38799.67ms\r\nINFO:tornado.access:200 POST /v1/models/cifar10:predict (127.0.0.1) 7599.63ms\r\nINFO:tornado.access:200 POST /v1/models/cifar10:predict (127.0.0.1) 39800.00ms\r\nINFO:tornado.access:200 POST /v1/models/cifar10:predict (127.0.0.1) 32200.33ms\r\n```\r\n\r\n**What did you expect to happen:**\r\nThe log format should include timestamp.\r\n\r\n**Anything else you would like to add:**\r\n[Miscellaneous information that will assist in solving the issue.]\r\n\r\n\r\n**Environment:**\r\n\r\n- Istio Version:\r\n- Knative Version:\r\n- KFServing Version: 0.2.0\r\n- Kubeflow version:\r\n- Minikube version:\r\n- Kubernetes version: (use `kubectl version`):\r\n- OS (e.g. from `/etc/os-release`):\r\n\n", "before_files": [{"content": "# Copyright 2019 kubeflow.org.\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 tornado.ioloop\nimport tornado.web\nimport tornado.httpserver\nimport argparse\nimport logging\nimport json\nfrom typing import List, Dict\nfrom kfserving.handlers.http import PredictHandler, ExplainHandler\nfrom kfserving import KFModel\nfrom kfserving.constants import constants\n\nDEFAULT_HTTP_PORT = 8080\nDEFAULT_GRPC_PORT = 8081\n\nparser = argparse.ArgumentParser(add_help=False)\nparser.add_argument('--http_port', default=DEFAULT_HTTP_PORT, type=int,\n                    help='The HTTP Port listened to by the model server.')\nparser.add_argument('--grpc_port', default=DEFAULT_GRPC_PORT, type=int,\n                    help='The GRPC Port listened to by the model server.')\nparser.add_argument('--workers', default=0, type=int,\n                    help='The number of works to fork')\nargs, _ = parser.parse_known_args()\n\nlogging.basicConfig(level=constants.KFSERVING_LOGLEVEL)\n\n\nclass KFServer():\n    def __init__(self, http_port: int = args.http_port,\n                 grpc_port: int = args.grpc_port,\n                 workers: int = args.workers):\n        self.registered_models = {}\n        self.http_port = http_port\n        self.grpc_port = grpc_port\n        self.workers = workers\n        self._http_server = None\n\n    def create_application(self):\n        return tornado.web.Application([\n            # Server Liveness API returns 200 if server is alive.\n            (r\"/\", LivenessHandler),\n            (r\"/v1/models\",\n             ListHandler, dict(models=self.registered_models)),\n            # Model Health API returns 200 if model is ready to serve.\n            (r\"/v1/models/([a-zA-Z0-9_-]+)\",\n             HealthHandler, dict(models=self.registered_models)),\n            (r\"/v1/models/([a-zA-Z0-9_-]+):predict\",\n             PredictHandler, dict(models=self.registered_models)),\n            (r\"/v1/models/([a-zA-Z0-9_-]+):explain\",\n             ExplainHandler, dict(models=self.registered_models)),\n        ])\n\n    def start(self, models: List[KFModel]):\n        for model in models:\n            self.register_model(model)\n\n        self._http_server = tornado.httpserver.HTTPServer(\n            self.create_application())\n\n        logging.info(\"Listening on port %s\", self.http_port)\n        self._http_server.bind(self.http_port)\n        logging.info(\"Will fork %d workers\", self.workers)\n        self._http_server.start(self.workers)\n        tornado.ioloop.IOLoop.current().start()\n\n    def register_model(self, model: KFModel):\n        if not model.name:\n            raise Exception(\n                \"Failed to register model, model.name must be provided.\")\n        self.registered_models[model.name] = model\n        logging.info(\"Registering model: %s\", model.name)\n\n\nclass LivenessHandler(tornado.web.RequestHandler):  # pylint:disable=too-few-public-methods\n    def get(self):\n        self.write(\"Alive\")\n\n\nclass HealthHandler(tornado.web.RequestHandler):\n    def initialize(self, models: Dict[str, KFModel]):\n        self.models = models  # pylint:disable=attribute-defined-outside-init\n\n    def get(self, name: str):\n        if name not in self.models:\n            raise tornado.web.HTTPError(\n                status_code=404,\n                reason=\"Model with name %s does not exist.\" % name\n            )\n\n        model = self.models[name]\n        self.write(json.dumps({\n            \"name\": model.name,\n            \"ready\": model.ready\n        }))\n\n\nclass ListHandler(tornado.web.RequestHandler):\n    def initialize(self, models: Dict[str, KFModel]):\n        self.models = models  # pylint:disable=attribute-defined-outside-init\n\n    def get(self):\n        self.write(json.dumps(list(self.models.values())))\n", "path": "python/kfserving/kfserving/kfserver.py"}], "after_files": [{"content": "# Copyright 2019 kubeflow.org.\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 argparse\nimport logging\nimport json\nfrom typing import List, Dict\nimport tornado.ioloop\nimport tornado.web\nimport tornado.httpserver\nimport tornado.log\nfrom kfserving.handlers.http import PredictHandler, ExplainHandler\nfrom kfserving import KFModel\n\nDEFAULT_HTTP_PORT = 8080\nDEFAULT_GRPC_PORT = 8081\n\nparser = argparse.ArgumentParser(add_help=False)\nparser.add_argument('--http_port', default=DEFAULT_HTTP_PORT, type=int,\n                    help='The HTTP Port listened to by the model server.')\nparser.add_argument('--grpc_port', default=DEFAULT_GRPC_PORT, type=int,\n                    help='The GRPC Port listened to by the model server.')\nparser.add_argument('--workers', default=0, type=int,\n                    help='The number of works to fork')\nargs, _ = parser.parse_known_args()\n\ntornado.log.enable_pretty_logging()\n\nclass KFServer():\n    def __init__(self, http_port: int = args.http_port,\n                 grpc_port: int = args.grpc_port,\n                 workers: int = args.workers):\n        self.registered_models = {}\n        self.http_port = http_port\n        self.grpc_port = grpc_port\n        self.workers = workers\n        self._http_server = None\n\n    def create_application(self):\n        return tornado.web.Application([\n            # Server Liveness API returns 200 if server is alive.\n            (r\"/\", LivenessHandler),\n            (r\"/v1/models\",\n             ListHandler, dict(models=self.registered_models)),\n            # Model Health API returns 200 if model is ready to serve.\n            (r\"/v1/models/([a-zA-Z0-9_-]+)\",\n             HealthHandler, dict(models=self.registered_models)),\n            (r\"/v1/models/([a-zA-Z0-9_-]+):predict\",\n             PredictHandler, dict(models=self.registered_models)),\n            (r\"/v1/models/([a-zA-Z0-9_-]+):explain\",\n             ExplainHandler, dict(models=self.registered_models)),\n        ])\n\n    def start(self, models: List[KFModel]):\n        for model in models:\n            self.register_model(model)\n\n        self._http_server = tornado.httpserver.HTTPServer(\n            self.create_application())\n\n        logging.info(\"Listening on port %s\", self.http_port)\n        self._http_server.bind(self.http_port)\n        logging.info(\"Will fork %d workers\", self.workers)\n        self._http_server.start(self.workers)\n        tornado.ioloop.IOLoop.current().start()\n\n    def register_model(self, model: KFModel):\n        if not model.name:\n            raise Exception(\n                \"Failed to register model, model.name must be provided.\")\n        self.registered_models[model.name] = model\n        logging.info(\"Registering model: %s\", model.name)\n\n\nclass LivenessHandler(tornado.web.RequestHandler):  # pylint:disable=too-few-public-methods\n    def get(self):\n        self.write(\"Alive\")\n\n\nclass HealthHandler(tornado.web.RequestHandler):\n    def initialize(self, models: Dict[str, KFModel]):\n        self.models = models  # pylint:disable=attribute-defined-outside-init\n\n    def get(self, name: str):\n        if name not in self.models:\n            raise tornado.web.HTTPError(\n                status_code=404,\n                reason=\"Model with name %s does not exist.\" % name\n            )\n\n        model = self.models[name]\n        self.write(json.dumps({\n            \"name\": model.name,\n            \"ready\": model.ready\n        }))\n\n\nclass ListHandler(tornado.web.RequestHandler):\n    def initialize(self, models: Dict[str, KFModel]):\n        self.models = models  # pylint:disable=attribute-defined-outside-init\n\n    def get(self):\n        self.write(json.dumps(list(self.models.values())))\n", "path": "python/kfserving/kfserving/kfserver.py"}]}