Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/OCR-D/core
Browse files Browse the repository at this point in the history
  • Loading branch information
kba committed Jun 4, 2024
2 parents 316253f + cffe669 commit 4a0fb2d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/ocrd/mets_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class ClientSideOcrdMets():

def __init__(self, url):
self.protocol = 'tcp' if url.startswith('http://') else 'uds'
self.log = getLogger(f'ocrd.mets_client[{url}]')
self.log = getLogger(f'ocrd.models.ocrd_mets.client.{url}')
self.url = url if self.protocol == 'tcp' else f'http+unix://{url.replace("/", "%2F")}'

@property
Expand Down Expand Up @@ -197,12 +197,12 @@ def __init__(self, workspace, url):
self.workspace = workspace
self.url = url
self.is_uds = not (url.startswith('http://') or url.startswith('https://'))
self.log = getLogger(f'ocrd.mets_server[{self.url}]')
self.log = getLogger(f'ocrd.models.ocrd_mets.server.{self.url}')

def shutdown(self):
if self.is_uds:
if Path(self.url).exists():
self.log.warning(f'UDS socket {self.url} still exists, removing it')
self.log.debug(f'UDS socket {self.url} still exists, removing it')
Path(self.url).unlink()
# os._exit because uvicorn catches SystemExit raised by sys.exit
_exit(0)
Expand Down Expand Up @@ -300,7 +300,7 @@ async def stop():
"""
Stop the server
"""
getLogger('ocrd.models.ocrd_mets').info(f'Shutting down METS Server {self.url}')
self.log.info(f'Shutting down')
workspace.save_mets()
self.shutdown()

Expand All @@ -319,6 +319,8 @@ async def stop():
else:
parsed = urlparse(self.url)
uvicorn_kwargs = {'host': parsed.hostname, 'port': parsed.port}
uvicorn_kwargs['log_config'] = None
uvicorn_kwargs['access_log'] = False

self.log.debug("Starting uvicorn")
uvicorn.run(app, **uvicorn_kwargs)
4 changes: 2 additions & 2 deletions src/ocrd_utils/ocrd_logging.conf
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ level=INFO
handlers=consoleHandler
qualname=uvicorn
[logger_uvicorn_access]
level=DEBUG
level=WARN
handlers=consoleHandler
qualname=uvicorn.access
[logger_uvicorn_error]
level=DEBUG
level=INFO
handlers=consoleHandler
qualname=uvicorn.error
[logger_multipart]
Expand Down

0 comments on commit 4a0fb2d

Please sign in to comment.