Log Analysis
Log Configuration
OBS BrowserJS SDK provides the logging function. You can call ObsClient.initLog to enable and configure logging. Sample code is as follows:
obsClient.initLog({
level:'warn', // Set the log level.
});
- Logs printed by the SDK will be displayed in the Console of the developer tool provided by the browser.
- The logging function is disabled by default. You need to enable it if needed.
Log Format
The SDK log format is: Log time|log level|log content. The following are example logs:
2018/2/11 PM 9:22:45|info|ListObjects|enter ListObjects... 2018/2/11 PM 9:22:45|info|ListObjects|prepare request parameters ok,then Send request to service start 2018/2/11 PM 9:22:45|info|ListObjects|http cost 19 ms 2018/2/11 PM 9:22:45|info|ListObjects|get response start, statusCode:200
Log Level
When current logs cannot be used to troubleshoot system faults, you can change the log level to obtain more information. You can obtain the most information in debug logs and the least information in error logs.
Log level description:
- debug: Debugging level. If this level is set, all logs will be printed.
- info: Information level. If this level is set, information about logs of the warn level and time consumed for each HTTP/HTTPS request will be printed.
- warn: Warning level. If this level is set, information about logs at the error level and information about partial critical events will be printed.
- error: Error level. If this level is set, only error information will be printed.
Last Article: SDK Common Result Objects
Next Article: FAQs
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.