After you import SOFATracer into an application, you can add configuration items to the `application.properties` file in Spring Boot to customize the behavior of SOFATracer.
The SOFATracer log output directory is determined by the `logging.path` setting in `application.properties`. The output path is `${logging.path}/tracelog`. If `logging.path` is not configured, the default path is `${user.home}/logs/tracelog`.
Spring Boot project configuration
SOFA Tracer configuration item | Description | Default value |
logging.path | Log output directory | SOFATracer prioritizes output to the `logging.path` directory. If the log output directory is not configured, the default output directory is `${user.home}`. |
com.alipay.sofa.tracer.disableDigestLog | Specifies whether to disable summary log printing for all components integrated with SOFATracer. | false |
com.alipay.sofa.tracer.disableConfiguration[${logType}] | Disables summary log printing for a specific SOFATracer component of the specified `${logType}`. `${logType}` refers to a specific log type, such as `spring-mvc-digest.log`. | false |
com.alipay.sofa.tracer.tracerGlobalRollingPolicy | The rolling policy for SOFATracer logs. | `.yyyy-MM-dd`: Rolls over daily. `.yyyy-MM-dd_HH`: Rolls over hourly. If not configured, logs roll over daily by default. |
com.alipay.sofa.tracer.tracerGlobalLogReserveDay | The number of days to retain SOFATracer logs. | `7` days by default. |
com.alipay.sofa.tracer.statLogInterval | The interval for statistics logs, in seconds. | Statistics logs are output every `60` seconds by default. |
com.alipay.sofa.tracer.baggageMaxLength | The maximum allowed length for pass-through data. | `1024` characters by default. |
com.alipay.sofa.tracer.zipkin.enabled | Specifies whether to enable remote reporting of SOFATracer data to Zipkin. | `true`: Enables reporting. `false`: Disables reporting. Reporting is disabled by default. |
com.alipay.sofa.tracer.zipkin.baseUrl | The address for remote reporting of SOFATracer data to Zipkin. This configuration is effective only when `com.alipay.sofa.tracer.zipkin.enabled` is set to `true`. | Format: `http://${host}:${port}` |
com.alipay.sofa.tracer.springmvc.filterOrder | The order in which the SOFATracer filter for Spring MVC takes effect. | -2147483647 (`org.springframework.core.Ordered#HIGHEST_PRECEDENCE + 1`) |
com.alipay.sofa.tracer.springmvc.urlPatterns | The URL pattern path where the SOFATracer filter for Spring MVC takes effect. |
|
com.alipay.sofa.tracer.JSONOutput | Specifies whether to output logs in JSON format. | `true`. To reduce log space usage, use a non-JSON format. The log order is the same as in the JSON format. |
Non-Spring Boot project configuration
For non-Spring Boot projects, you need to create a `sofa.tracer.properties` configuration file in the classpath. The configuration items are as follows:
SOFA Tracer configuration item | Description | Default value |
disable_middleware_digest_log | Specifies whether to disable summary log printing for middleware components. | false |
disable_digest_log | Disables summary log printing. | false |
tracer_global_rolling_policy | The rolling policy for SOFATracer logs. | `.yyyy-MM-dd`: Rolls over daily. `.yyyy-MM-dd_HH`: Rolls over hourly. If not configured, logs roll over daily by default. |
tracer_global_log_reserve_day | The number of days to retain SOFATracer logs. | `7` days by default. |
stat_log_interval | The interval for statistics logs, in seconds. | Statistics logs are output every `60` seconds by default. |
tracer_penetrate_attribute_max_length | The maximum allowed length for pass-through data. | `1024` characters by default. |
tracer_async_appender_allow_discard | Specifies whether to allow log loss. | false |
tracer_async_appender_is_out_discard_number | Number of discarded logs. | 0 |
spring.application.name | Application name. | - |
tracer_sampler_strategy_name_key | Sampling policy name. | - |
tracer_sampler_strategy_custom_rule_class_name | The fully qualified name of the class that implements the sampling rule Service Provider Interface (SPI). | - |
tracer_sampler_strategy_percentage_key | Sampling ratio. | - |
com.alipay.sofa.tracer.JSONOutput | Specifies whether to output logs in JSON format. | `true`. To reduce log space usage, use a non-JSON format. The log order is the same as in the JSON format. |