Adam
10/26/2022, 2:21 PMKhuyen Tran
10/26/2022, 3:42 PM~/.prefect/logging.yml
. You can change the setting of the logging by typing:
prefect config set PREFECT_LOGGING_[PATH]_[TO]_[KEY]=VALUE
To change the formatter to json, you can type:
prefect config set PREFECT_LOGGING_HANDLERS_CONSOLE_FORMATTER=json
prefect config set PREFECT_LOGGING_HANDLERS_CONSOLE_TASK_RUNS_FORMATTER=json
prefect config set PREFECT_LOGGING_HANDLERS_CONSOLE_FLOW_RUNS_FORMATTER=json
Or simply change the value in ~/.prefect/logging.yml
handlers:
# The handlers we define here will output all logs they receive by default
# but we include the `level` so it can be overridden by environment
console:
level: 0
class: logging.StreamHandler
formatter: json
console_flow_runs:
level: 0
class: logging.StreamHandler
formatter: json
console_task_runs:
level: 0
class: logging.StreamHandler
formatter: json
orion:
level: 0
class: prefect.logging.handlers.OrionHandler
Adam
10/26/2022, 9:51 PMKhuyen Tran
10/27/2022, 4:48 PMenvironment
field) to be the above. For example,
{
"PREFECT_LOGGING_HANDLERS_CONSOLE_FORMATTER": "json",
"PREFECT_LOGGING_HANDLERS_CONSOLE_TASK_RUNS_FORMATTER": "json",
"PREFECT_LOGGING_HANDLERS_CONSOLE_FLOW_RUNS_FORMATTER": "json"
}
terrence
10/27/2022, 5:45 PMAdam
10/28/2022, 6:08 PM{'name': 'prefect.flow_runs', 'msg': "Finished in state Completed('All states completed.')", 'args': [], 'levelname': 'INFO', 'levelno': 20, 'pathname': '/usr/local/lib/python3.9/site-packages/prefect/engine.py', 'filename': 'engine.py', 'module': 'engine', 'exc_info': None, 'exc_text': None, 'stack_info': None, 'lineno': 366, 'funcName': 'begin_flow_run', 'created': 1666970625.7505996, 'msecs': 750.5996227264404, 'relativeCreated': 5440.329074859619, 'thread': 140168457979712, 'threadName': 'MainThread', 'processName': 'MainProcess', 'process': 7, 'flow_run_name': 'fancy-alpaca', 'flow_run_id': '61694402-3773-4e93-a24d-55318dbe0de1', 'flow_name': 'my_new_flow', 'send_to_orion': False}
Note the single quotes and the use of types like False
and None
print(some_dict)
instead of json.dumps(some_dict)
?str
be json.dumps
instead? A string representation of a dict is not really JSON…Khuyen Tran
10/31/2022, 3:14 PM