Add gunicorn log handler and formatter
Use handler and formatter for gunicorn. Change-Id: I036720c4317cb234c16a4026d9b9bc4a193f69db
This commit is contained in:
parent
08c6265d1e
commit
212cdcc2d9
@ -1,12 +1,67 @@
|
||||
# Copyright 2022 99cloud
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import multiprocessing
|
||||
|
||||
bind = "unix:/var/lib/skyline/skyline.sock"
|
||||
workers = (1 + multiprocessing.cpu_count()) // 2
|
||||
worker_class = "uvicorn.workers.UvicornWorker"
|
||||
timeout = 3600
|
||||
timeout = 300
|
||||
keepalive = 5
|
||||
reuse_port = True
|
||||
proc_name = "skyline"
|
||||
log_level = "debug"
|
||||
accesslog = "/var/log/skyline/access.log"
|
||||
errorlog = "/var/log/skyline/error.log"
|
||||
|
||||
logconfig_dict = {
|
||||
"version": 1,
|
||||
"disable_existing_loggers": False,
|
||||
"root": {"level": "DEBUG", "handlers": ["console"]},
|
||||
"loggers": {
|
||||
"gunicorn.error": {
|
||||
"level": "DEBUG",
|
||||
"handlers": ["error_file"],
|
||||
"propagate": 0,
|
||||
"qualname": "gunicorn_error",
|
||||
},
|
||||
"gunicorn.access": {
|
||||
"level": "DEBUG",
|
||||
"handlers": ["access_file"],
|
||||
"propagate": 0,
|
||||
"qualname": "access",
|
||||
},
|
||||
},
|
||||
"handlers": {
|
||||
"error_file": {
|
||||
"class": "logging.handlers.RotatingFileHandler",
|
||||
"formatter": "generic",
|
||||
"filename": "/var/log/skyline/error.log",
|
||||
},
|
||||
"access_file": {
|
||||
"class": "logging.handlers.RotatingFileHandler",
|
||||
"formatter": "generic",
|
||||
"filename": "/var/log/skyline/access.log",
|
||||
},
|
||||
"console": {
|
||||
"class": "logging.StreamHandler",
|
||||
"level": "DEBUG",
|
||||
"formatter": "generic",
|
||||
},
|
||||
},
|
||||
"formatters": {
|
||||
"generic": {
|
||||
"format": "%(asctime)s.%(msecs)03d %(process)d %(levelname)s [-] %(message)s",
|
||||
"datefmt": "[%Y-%m-%d %H:%M:%S %z]",
|
||||
"class": "logging.Formatter",
|
||||
}
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user