log db validation error to see what postgres is doing
This commit is contained in:
parent
bc9d820e1d
commit
115e126873
|
@ -1,6 +1,7 @@
|
||||||
"""Logging_service."""
|
"""Logging_service."""
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
import re
|
||||||
from typing import Any
|
from typing import Any
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
|
@ -113,6 +114,8 @@ def setup_logger(app: Flask) -> None:
|
||||||
"%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
"%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
app.logger.debug("Printing log to create app logger")
|
||||||
|
|
||||||
# the json formatter is nice for real environments but makes
|
# the json formatter is nice for real environments but makes
|
||||||
# debugging locally a little more difficult
|
# debugging locally a little more difficult
|
||||||
if app.env != "development":
|
if app.env != "development":
|
||||||
|
@ -140,7 +143,8 @@ def setup_logger(app: Flask) -> None:
|
||||||
|
|
||||||
# make all loggers act the same
|
# make all loggers act the same
|
||||||
for name in logging.root.manager.loggerDict:
|
for name in logging.root.manager.loggerDict:
|
||||||
if "spiff" not in name:
|
# use a regex so spiffworkflow_backend isn't filtered out
|
||||||
|
if not re.match(r"^spiff\b", name):
|
||||||
the_logger = logging.getLogger(name)
|
the_logger = logging.getLogger(name)
|
||||||
the_logger.setLevel(log_level)
|
the_logger.setLevel(log_level)
|
||||||
if spiff_logger_filehandler:
|
if spiff_logger_filehandler:
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
"""Secret_service."""
|
"""Secret_service."""
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
|
from flask import current_app
|
||||||
from flask_bpmn.api.api_error import ApiError
|
from flask_bpmn.api.api_error import ApiError
|
||||||
from flask_bpmn.models.db import db
|
from flask_bpmn.models.db import db
|
||||||
from sqlalchemy.exc import IntegrityError
|
from sqlalchemy.exc import IntegrityError
|
||||||
|
@ -46,11 +47,14 @@ class SecretService:
|
||||||
try:
|
try:
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise ApiError(
|
ae = ApiError(
|
||||||
code="create_secret_error",
|
code="create_secret_error",
|
||||||
message=f"There was an error creating a secret with key: {key} and value ending with: {value[:-4]}. "
|
message=f"There was an error creating a secret with key: {key} and value ending with: {value[:-4]}. "
|
||||||
f"Original error is {e}",
|
f"Original error is {e}",
|
||||||
) from e
|
)
|
||||||
|
# log the error so we can see what postgres is doing
|
||||||
|
current_app.logger.error(ae)
|
||||||
|
raise ae from e
|
||||||
return secret_model
|
return secret_model
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
Loading…
Reference in New Issue