Track Browser and Mobile Errors
이 페이지는 아직 한국어로 제공되지 않으며 번역 작업 중입니다. 번역에 관한 질문이나 의견이 있으시면 언제든지 저희에게 연락해 주십시오.
Overview
Error Tracking processes errors collected from browser and mobile Datadog SDKs. Whenever an error containing a stack trace is collected, Error Tracking processes and groups it under an issue, which is a grouping of similar errors.
An essential attribute for log errors is the stack trace in a log’s error.stack
. If you are sending stack traces to Datadog but they are not in error.stack
, you can set up a generic log remapper to remap the stack trace to the correct attribute in Datadog.
Your crash reports appear in Error Tracking.
Setup
If you have not set up the Datadog Browser SDK yet, follow the in-app setup instructions or see the Browser Logs setup documentation.
Download the latest version of the Logs Browser SDK. Error Tracking requires at least v4.36.0
.
Configure your application’s version
, env
, and service
when initializing the SDK. For example, with NPM:
import { datadogLogs } from '@datadog/browser-logs'
datadogLogs.init({
clientToken: '<DATADOG_CLIENT_TOKEN>',
site: '<DATADOG_SITE>',
service: '<MY_SERVICE>',
env: '<MY_ENV>',
forwardErrorsToLogs: true,
sessionSampleRate: 100,
})
To log a caught exception yourself, you may use the optional error parameter:
try {
throw new Error('wrong behavior');
} catch(err) {
datadogLogs.logger.error("an error occurred", {usr: {id: 123}}, err);
}
Note: Error Tracking only considers errors that are instances of Error
.
Further Reading
Additional helpful documentation, links, and articles: