daml/libs-scala/contextualized-logging/BUILD.bazel
Victor Peter Rouven Müller 6abb903a7f
[JSON-API] Put the request & response bodies into the log ctx if the log level is debug (for specific statements) (#10298)
* [JSON-API] Log json request & response bodies in debug

This also readds logging of incoming requests and the responses which are being send out.

changelog_begin

- [JSON-API] Logging of the request and response bodies are now available for appropriate requests if the chosen log level is equal or lower than DEBUG. These can then be found in the logging context of the request begin & end log messages (The field names in the ctx are "request_body" and "response_body").

changelog_end

* Move the http request throughput marking to the right place including the logging of the processing time

* Ensure that the processing time measuring is implemented consistent
2021-07-19 14:52:23 +00:00

62 lines
2.0 KiB
Python

# Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load(
"//bazel_tools:scala.bzl",
"da_scala_library",
"da_scala_test_suite",
)
da_scala_library(
name = "contextualized-logging",
srcs = glob(["src/main/scala/**/*.scala"]),
scala_deps = [
"@maven//:com_typesafe_akka_akka_actor",
"@maven//:com_typesafe_akka_akka_stream",
"@maven//:io_spray_spray_json",
],
scalacopts = ["-Xsource:2.13"],
tags = ["maven_coordinates=com.daml:contextualized-logging:__VERSION__"],
versioned_scala_deps = {
"2.12": ["@maven//:org_scala_lang_modules_scala_collection_compat"],
},
visibility = [
"//visibility:public",
],
deps = [
"//libs-scala/grpc-utils",
"//libs-scala/logging-entries",
"@maven//:com_fasterxml_jackson_core_jackson_core",
"@maven//:io_grpc_grpc_api",
"@maven//:net_logstash_logback_logstash_logback_encoder",
"@maven//:org_slf4j_slf4j_api",
],
)
da_scala_test_suite(
name = "contextualized-logging-tests",
srcs = glob(["src/test/suite/**/*.scala"]),
resources = glob(["src/test/suite/resources/**/*"]),
scala_deps = [
"@maven//:com_chuusai_shapeless",
"@maven//:com_typesafe_akka_akka_actor",
"@maven//:com_typesafe_akka_akka_stream",
"@maven//:io_circe_circe_core",
"@maven//:io_circe_circe_generic",
"@maven//:io_circe_circe_parser",
"@maven//:org_mockito_mockito_scala",
"@maven//:org_typelevel_cats_core",
"@maven//:org_typelevel_cats_kernel",
],
deps = [
":contextualized-logging",
"//libs-scala/logging-entries",
"@maven//:ch_qos_logback_logback_classic",
"@maven//:ch_qos_logback_logback_core",
"@maven//:com_fasterxml_jackson_core_jackson_core",
"@maven//:net_logstash_logback_logstash_logback_encoder",
"@maven//:org_mockito_mockito_core",
"@maven//:org_slf4j_slf4j_api",
],
)