logowanie dla health
This commit is contained in:
@@ -5,4 +5,4 @@ RUN apt-get update && apt-get install -y build-essential libmaxminddb0 libmaxmin
|
|||||||
RUN pip install --no-cache-dir -r app/requirements.txt
|
RUN pip install --no-cache-dir -r app/requirements.txt
|
||||||
COPY . /app
|
COPY . /app
|
||||||
ENV PYTHONUNBUFFERED=1
|
ENV PYTHONUNBUFFERED=1
|
||||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--log-config", "logging.yml"]
|
||||||
|
@@ -4,7 +4,7 @@ services:
|
|||||||
container_name: ip-geo-api
|
container_name: ip-geo-api
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- "${HOST_PORT:-8080}:8000"
|
- "${PORT:-8080}:8000"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test:
|
test:
|
||||||
[
|
[
|
||||||
|
37
logging.yml
Normal file
37
logging.yml
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
version: 1
|
||||||
|
disable_existing_loggers: False
|
||||||
|
|
||||||
|
filters:
|
||||||
|
ignore_health:
|
||||||
|
(): logging.Filter
|
||||||
|
filter: >
|
||||||
|
lambda record: "/health" not in record.getMessage()
|
||||||
|
|
||||||
|
formatters:
|
||||||
|
default:
|
||||||
|
format: '%(levelprefix)s %(client_addr)s - "%(request_line)s" %(status_code)s'
|
||||||
|
use_colors: true
|
||||||
|
|
||||||
|
handlers:
|
||||||
|
access:
|
||||||
|
class: logging.StreamHandler
|
||||||
|
formatter: default
|
||||||
|
filters: [ignore_health]
|
||||||
|
|
||||||
|
default:
|
||||||
|
class: logging.StreamHandler
|
||||||
|
formatter: default
|
||||||
|
|
||||||
|
loggers:
|
||||||
|
uvicorn:
|
||||||
|
level: INFO
|
||||||
|
handlers: [default]
|
||||||
|
propagate: no
|
||||||
|
uvicorn.error:
|
||||||
|
level: INFO
|
||||||
|
handlers: [default]
|
||||||
|
propagate: no
|
||||||
|
uvicorn.access:
|
||||||
|
level: INFO
|
||||||
|
handlers: [access]
|
||||||
|
propagate: no
|
Reference in New Issue
Block a user