Disable uvicorn access logging in favor of cleaner server-side logging, we already get all that info; Print the request metadata

This commit is contained in:
cmdr2 2022-12-09 22:47:34 +05:30
parent cde8c2d3bd
commit a2af811ad2
5 changed files with 7 additions and 6 deletions

View File

@ -393,7 +393,7 @@ call python --version
@if NOT DEFINED SD_UI_BIND_PORT set SD_UI_BIND_PORT=9000
@if NOT DEFINED SD_UI_BIND_IP set SD_UI_BIND_IP=0.0.0.0
@uvicorn server:server_api --app-dir "%SD_UI_PATH%" --port %SD_UI_BIND_PORT% --host %SD_UI_BIND_IP%
@uvicorn server:server_api --app-dir "%SD_UI_PATH%" --port %SD_UI_BIND_PORT% --host %SD_UI_BIND_IP% --log-level critical
@pause

View File

@ -322,6 +322,6 @@ cd ..
export SD_UI_PATH=`pwd`/ui
cd stable-diffusion
uvicorn server:server_api --app-dir "$SD_UI_PATH" --port ${SD_UI_BIND_PORT:-9000} --host ${SD_UI_BIND_IP:-0.0.0.0}
uvicorn server:server_api --app-dir "$SD_UI_PATH" --port ${SD_UI_BIND_PORT:-9000} --host ${SD_UI_BIND_IP:-0.0.0.0} --log-level critical
read -p "Press any key to continue"

View File

@ -8,12 +8,12 @@ from rich.logging import RichHandler
from sd_internal import task_manager
LOG_FORMAT = '[%(threadName)s] %(message)s'
LOG_FORMAT = '%(levelname)s %(threadName)s %(message)s'
logging.basicConfig(
level=logging.INFO,
format=LOG_FORMAT,
datefmt="[%X.%f]",
handlers=[RichHandler(markup=True)]
datefmt="%X.%f",
handlers=[RichHandler(markup=True, rich_tracebacks=True, show_level=False)]
)
log = logging.getLogger()

View File

@ -70,6 +70,7 @@ def reload_models_if_necessary(req: Request):
def make_images(req: Request, data_queue: queue.Queue, task_temp_images: list, step_callback):
try:
log.info(req)
return _make_images_internal(req, data_queue, task_temp_images, step_callback)
except Exception as e:
log.error(traceback.format_exc())

View File

@ -19,7 +19,7 @@ from sd_internal import Request, device_manager
log = logging.getLogger()
THREAD_NAME_PREFIX = 'Runtime-Render/'
THREAD_NAME_PREFIX = ''
ERR_LOCK_FAILED = ' failed to acquire lock within timeout.'
LOCK_TIMEOUT = 15 # Maximum locking time in seconds before failing a task.
# It's better to get an exception than a deadlock... ALWAYS use timeout in critical paths.