이 페이지는 아직 영어로 제공되지 않습니다. 번역 작업 중입니다.
현재 번역 프로젝트에 대한 질문이나 피드백이 있으신 경우 언제든지 연락주시기 바랍니다.

Automated debug log collection

Automated debug logs are supported for Node.js and .NET only. For other languages, use manual debug log collection instead.

A flare allows you to send necessary troubleshooting information to the Datadog support team, including tracer logs, with sensitive data removed. Flares are useful for troubleshooting issues like high CPU usage, high memory usage, and missing spans.

Prerequisites

  • Remote Configuration must be enabled.
  • Your API key must be configured for Remote Configuration.
  • You must have a supported tracer version:
    • Java: 1.26.0 or greater
    • Python: 2.11.0 or greater
    • Node.js: 5.15.0 or greater, or 4.39.0 or greater
    • .NET: 2.46.0 or greater

Send a flare

To send a flare from the Datadog site, make sure you’ve enabled Fleet Automation and Remote Configuration on the Agent. To send a remote flare:

  1. From the Fleet Automation page, select an Agent that requires support.
  2. Click Support.
  3. Click Send Support Ticket.
  4. Provide an existing Zendesk support ticket number. If you don’t provide a ticket number, one is created on your behalf.
  5. Enable Debug mode to allow Datadog support staff to troubleshoot your issue faster. The log level is reset to its previous configuration after you send the flare.
  6. If you are troubleshooting your application, enable application tracer level logs to be included in the flare.
  7. Click Send Ticket.

For example:

The Send Ticket button launches a form to send a flare for an existing or new support ticket

Enable debug mode

Use Datadog debug settings to diagnose issues or audit trace data. Datadog does not recommend that you enable debug mode in production systems because it increases the number of events that are sent to your loggers. Use debug mode for debugging purposes only.

Debug mode is disabled by default. To enable it, follow the corresponding language tracer instructions:

The steps for enabling debug mode in the Datadog Python Tracer depends on the version of the tracer your application is using. Choose the scenario that applies:

Scenario 1: ddtrace version 2.x and higher

  1. To enable debug mode: DD_TRACE_DEBUG=true

  2. To route debug logs to a log file, set DD_TRACE_LOG_FILE to the filename of that log file, relative to the current working directory. For example, DD_TRACE_LOG_FILE=ddtrace_logs.log. By default, the file size is 15728640 bytes (about 15MB), and one backup log file is created. To increase the default log file size, specify the size in bytes with the DD_TRACE_LOG_FILE_SIZE_BYTES setting.

Note: If the application uses the root logger and changes log level to DEBUG, debug tracer logs are enabled. If you want to override this behavior, override the ddtrace logger as follows:

import logging

# root logger configuration
root_logger = logging.getLogger()
root_logger.setLevel(logging.DEBUG)

# override the ddtrace configuration to WARNING log level
logging.getLogger("ddtrace").setLevel(logging.WARNING)

Scenario 2: ddtrace version 1.3.2 to <2.x

  1. To enable debug mode: DD_TRACE_DEBUG=true

  2. To route debug logs to a log file, set DD_TRACE_LOG_FILE with a filename that tracer logs should be written to, relative to the current working directory. For example, DD_TRACE_LOG_FILE=ddtrace_logs.log. By default, the file size is 15728640 bytes (about 15MB) and one backup log file is created. To increase the default log file size, specify the size in bytes with the DD_TRACE_LOG_FILE_SIZE_BYTES setting.

  3. To route logs to the console, for Python 2 applications, configure logging.basicConfig() or similar. Logs are automatically sent to the console for Python 3 applications.

Scenario 3: ddtrace version 1.0.x to 1.2.x

  1. To enable debug mode: DD_TRACE_DEBUG=true

  2. To route logs to the console, for Python 2 or Python 3 applications, configure logging.basicConfig() or use DD_CALL_BASIC_CONFIG=true.

Scenario 4: ddtrace version 0.x

  1. To enable debug mode: DD_TRACE_DEBUG=true

  2. To route logs to the console, for Python 2 or Python 3 applications, configure logging.basicConfig() or use DD_CALL_BASIC_CONFIG=true.

Scenario 5: Configuring debug logging in the application code with the standard logging library

For any version of ddtrace, rather than setting the DD_TRACE_DEBUG tracer environment variable, you can enable debug logging in the application code by using the logging standard library directly:

log = logging.getLogger("ddtrace.tracer")
log.setLevel(logging.DEBUG)

Review debug logs

When debug mode for your tracer is enabled, tracer-specific log messages report how the tracer was initialized and whether traces were sent to the Agent. Debug logs are stored in a separate path depending on your logging configuration. If you enable application-level tracer information, debug logs are also sent in the flare for supported languages. The following log examples show what might appear in your log file.

If there are errors that you don’t understand, or if traces are reported as flushed to Datadog but you cannot see them in the Datadog UI, contact Datadog support and provide the relevant log entries with a flare.

Logs generated by the Python Tracer have the logging handler name ddtrace.

Traces were generated:

<YYYY-MM-DD> 19:51:22,262 DEBUG [ddtrace.internal.processor.trace] [trace.py:211] - trace <TRACE ID> has 8 spans, 7 finished

Span generated by the Python tracer:

<YYYY-MM-DD> 19:51:22,251 DEBUG [ddtrace.tracer] [tracer.py:715] - finishing span name='flask.process_response' id=<SPAN ID> trace_id=<TRACE ID>  parent_id=<PARENT ID> service='flask' resource='flask.process_response' type=None start=1655495482.2478693 end=1655495482.2479873 duration=0.000118125 error=0 tags={} metrics={} (enabled:True)
0.0:5050/

Traces were sent to the Datadog Agent:

<YYYY-MM-DD> 19:59:19,657 DEBUG [ddtrace.internal.writer] [writer.py:405] - sent 1.57KB in 0.02605s to http://localhost:8126/v0.4/traces

Traces failed to be sent to the Datadog Agent:

<YYYY-MM-DD> 19:51:23,249 ERROR [ddtrace.internal.writer] [writer.py:567] - failed to send traces to Datadog Agent at http://localhost:8126/v0.4/traces

Further Reading

추가 유용한 문서, 링크 및 기사:

PREVIEWING: brett.blue/reorg-otel