Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
springcloudsleuth未向Hibernate查询日志添加键_Spring_Spring Data Jpa_Spring Cloud_Spring Cloud Sleuth - Fatal编程技术网

springcloudsleuth未向Hibernate查询日志添加键

springcloudsleuth未向Hibernate查询日志添加键,spring,spring-data-jpa,spring-cloud,spring-cloud-sleuth,Spring,Spring Data Jpa,Spring Cloud,Spring Cloud Sleuth,当我使用SpringCloudSleuth时,我注意到它正在为所有应用程序日志添加应用程序名称和关键细节 但是,对于Hibernate日志或jpa查询,这种情况不会发生 使用sleuth有什么方法可以实现这一点吗?您可以通过py6spy查看与JDBC的勇敢集成 从文档中摘录: brave-instrumentation-p6spy This includes a tracing event listener for P6Spy (a proxy for calls to your JDBC d

当我使用SpringCloudSleuth时,我注意到它正在为所有应用程序日志添加应用程序名称和关键细节

但是,对于Hibernate日志或jpa查询,这种情况不会发生


使用sleuth有什么方法可以实现这一点吗?您可以通过py6spy查看与JDBC的勇敢集成

从文档中摘录:

brave-instrumentation-p6spy

This includes a tracing event listener for P6Spy (a proxy for calls to your JDBC driver). It reports to Zipkin how long each statement takes, along with relevant tags like the query.

P6Spy requires a spy.properties in your application classpath (ex src/main/resources). brave.p6spy.TracingP6Factory must be in the modulelist to enable tracing.

modulelist=brave.p6spy.TracingP6Factory
url=jdbc:p6spy:derby:memory:p6spy;create=true

In addition, you can specify the following options in spy.properties

remoteServiceName

By default the zipkin service name for your database is the name of the database. Set this property to override it

remoteServiceName=myProductionDatabase

includeParameterValues

When set to to true, the tag sql.query will also include the JDBC parameter values.

Note: if you enable this please also consider enabling 'excludebinary' to avoid logging large blob values as hex (see http://p6spy.readthedocs.io/en/latest/configandusage.html#excludebinary).

includeParameterValues=true
excludebinary=true

spy.properties applies globally to any instrumented jdbc connection. To override this, add the zipkinServiceName property to your connection string.

jdbc:mysql://127.0.0.1:3306/mydatabase?zipkinServiceName=myServiceName

This will override the remoteServiceName set in spy.properties.

The current tracing component is used at runtime. Until you have instantiated brave.Tracing, no traces will appear.

您可以通过py6spy查看与JDBC的勇敢集成-

从文档中摘录:

brave-instrumentation-p6spy

This includes a tracing event listener for P6Spy (a proxy for calls to your JDBC driver). It reports to Zipkin how long each statement takes, along with relevant tags like the query.

P6Spy requires a spy.properties in your application classpath (ex src/main/resources). brave.p6spy.TracingP6Factory must be in the modulelist to enable tracing.

modulelist=brave.p6spy.TracingP6Factory
url=jdbc:p6spy:derby:memory:p6spy;create=true

In addition, you can specify the following options in spy.properties

remoteServiceName

By default the zipkin service name for your database is the name of the database. Set this property to override it

remoteServiceName=myProductionDatabase

includeParameterValues

When set to to true, the tag sql.query will also include the JDBC parameter values.

Note: if you enable this please also consider enabling 'excludebinary' to avoid logging large blob values as hex (see http://p6spy.readthedocs.io/en/latest/configandusage.html#excludebinary).

includeParameterValues=true
excludebinary=true

spy.properties applies globally to any instrumented jdbc connection. To override this, add the zipkinServiceName property to your connection string.

jdbc:mysql://127.0.0.1:3306/mydatabase?zipkinServiceName=myServiceName

This will override the remoteServiceName set in spy.properties.

The current tracing component is used at runtime. Until you have instantiated brave.Tracing, no traces will appear.