// This assembly is included in the following assemblies:
//
// assembly-deployment-configuration-kafka-bridge.adoc

[id='con-kafka-bridge-logging-{context}']
= Kafka Bridge loggers

Kafka Bridge has its own configurable loggers:

* `log4j.logger.io.strimzi.kafka.bridge`
* `log4j.logger.http.openapi.operation.__<operation-id>__`

You can replace `_<operation-id>_` in the `log4j.logger.http.openapi.operation.__<operation-id>__` logger to set log levels for specific operations:

* `createConsumer`
* `deleteConsumer`
* `subscribe`
* `unsubscribe`
* `poll`
* `assign`
* `commit`
* `send`
* `sendToPartition`
* `seekToBeginning`
* `seekToEnd`
* `seek`
* `healthy`
* `ready`
* `openapi`

Each operation is defined according OpenAPI specification, and has a corresponding API endpoint through which the bridge receives requests from HTTP clients.
You can change the log level on each endpoint to create fine-grained logging information about the incoming and outgoing HTTP requests.

Kafka Bridge uses the Apache `log4j` logger implementation.
Loggers are defined in the `log4j.properties` file, which has the following default configuration for `healthy` and `ready` endpoints:

```
log4j.logger.http.openapi.operation.healthy=WARN, out
log4j.additivity.http.openapi.operation.healthy=false
log4j.logger.http.openapi.operation.ready=WARN, out
log4j.additivity.http.openapi.operation.ready=false
```
The log level of all other operations is set to `INFO` by default.

Use the `logging` property to configure loggers and logger levels.

You can set the log levels by specifying the logger and level directly (inline) or use a custom (external) ConfigMap.
If a ConfigMap is used, you set `logging.name` property to the name of the ConfigMap containing the external logging configuration. Inside the ConfigMap, the logging configuration is described using `log4j.properties`.

Here we see examples of `inline` and `external` logging.

.Inline logging
[source,yaml,subs="+quotes,attributes"]
----
apiVersion: {KafkaApiVersion}
kind: KafkaBridge
spec:
  # ...
  logging:
    type: inline
    loggers:
      log4j.logger.io.strimzi.kafka.bridge: "INFO"
  # ...
----

.External logging
[source,yaml,subs="+quotes,attributes"]
----
apiVersion: {KafkaApiVersion}
kind: KafkaBridge
spec:
  # ...
  logging:
    type: external
    name: customConfigMap
  # ...
----

.Additional resources

* Garbage collector (GC) logging can also be enabled (or disabled). For more information about GC logging, see xref:ref-jvm-options-deployment-configuration-kafka[]
* For more information about log levels, see {ApacheLoggers}.
