Logging
In this section, we will learn how to configure Logging in KafkaFlow.
There are a few options you can use to add logging to KafkaFlow:
By default, KafkaFlow logs are ignored.
The default implementation is the NullLogHandler
.
Using Console Logger
The package KafkaFlow.LogHandler.Console can be installed to log the framework messages to the console output after the installation, use the method UseConsoleLog
in the configuration.
services.AddKafka(
kafka => kafka
.UseConsoleLog()
...
Using Microsoft Logging Framework
The package KafkaFlow.LogHandler.Microsoft can be installed to log the framework messages to the console output after the installation, use the method UseMicrosoftLog
in the configuration.
services.AddKafka(
kafka => kafka
.UseMicrosoftLog()
...
Using your own Logger
The framework has the ILogHandler
interface that can be implemented to log the framework's messages. The log handler can be configured in the configuration process using the method UseLogHandler
:
services.AddKafka(
kafka => kafka
.UseLogHandler<YourLogHandler>()
...