-
-
Notifications
You must be signed in to change notification settings - Fork 59
Closed
Description
After attempting to use the feature introduced here -> https://github.com/thangbn/json-logging-python/releases/tag/1.0.2
The project produces an error even after calling init_request_instrument
app = Flask(__name__)
json_logging.ENABLE_JSON_LOGGING = True
json_logging.init_flask()
json_logging.init_request_instrument(app)
logger = logging.getLogger("test-logger")
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.StreamHandler(sys.stdout))
logger.addHandler(logging.handlers.RotatingFileHandler(
filename="./output.log",
maxBytes=5000000,
backupCount=10
))
request_logger = json_logging.get_request_logger()
request_logger.addHandler(logging.handlers.RotatingFileHandler(
filename="./output.log",
maxBytes=5000000,
backupCount=10
))
produces
RuntimeError: please init request instrument first, call init_request_instrument(app) first
My end goal is to redirect the http request logs to a log file as well.
After inspecting the library (internal) code, I am not seeing where _request_logger
is ever assigned a value
https://github.com/thangbn/json-logging-python/blob/4cfe5f4785fa1650c6640bc77d3f8cf3927e4550/json_logging/__init__.py#L173
Metadata
Metadata
Assignees
Labels
No labels