Viewing Trace Logs
Overview
The trace mechanism records software stack maintenance and diagnosis information in memory during program execution. When the program crashes or the process terminates, this information is flushed to the disk as a file. This avoids frequent log file generation and writing at runtime, which would otherwise degrade the performance. Currently, only the standard
Log Description
The default root directory for storing trace logs is $HOME/ascend/atrace/. You can also use the environment variable ASCEND_WORK_PATH to specify the path for storing trace logs, for example, setting export ASCEND_WORK_PATH=/home/test. For details, see Environment Variables.
The path for storing trace logs is $HOME/ascend/atrace/trace_{Process group pid}_{PID of the process that loads the trace dynamic library for the first time}_{Timestamp of loading the trace dynamic library for the first time}/{event_name}_event_{Current process pid}_{Timestamp of generating the directory}/. event_name indicates the event type and the value can be schedule (service process exception, such as operator execution error), stackcore (process crash or exception signal received), or exit (normal exit from destruction).
- You can use the environment variable ASCEND_LOG_DEVICE_FLUSH_TIMEOUT to configure the delay for transferring device-side logs to the host. For details, see Environment Variables.
- The environment variable ASCEND_TRACE_RECORD_NUM can be used to control the aging specifications of the schedule_event_{PID of the current process}_{Timestamp when the directory is generated} subdirectory in the $HOME/ascend/atrace/trace_{Process group PID}_{PID of the process that loads the dynamic trace library for the first time}_{Timestamp when the dynamic trace library is loaded for the first time}/ directory. For details, see Environment Variables.
The preceding directories are shared by all apps in a container or on a physical machine. The number of log files increases with the increase of app processes. As a best practice, you should regularly clear the directories to ensure that the service functions properly. You can use the logrotate function provided by the system to segment logs.