Help Center/ ModelArts/ Troubleshooting/ Inference Deployment/ AI Application Management/ Failed to Obtain Certain Logs on the ModelArts Log Query Page
Updated on 2023-11-10 GMT+08:00

Failed to Obtain Certain Logs on the ModelArts Log Query Page

Symptom

I used a base image to import AI applications through OBS and wrote some inference code for implementing the inference logic. After an error occurred, I attempted to use the fault logs to locate the fault. However, certain logs were not displayed on the log query page in ModelArts.

Possible Causes

To display the logs of an inference service, print the logs on the console through coding. Python logging used by inference base images allows the display of only warning logs. To display INFO logs, set the log level to INFO in the code.

Solution

In the PY file for the inference code, set the default level of logs output to the console to INFO. The example code is as follows:

import logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')