Skip to content

How to inject a "FormatterOrLayout" into "KafkaLogHandlerRecorder" #40

Open
@JustNello

Description

@JustNello

Hello,
thank you for this project, providing out-of-the-box Kafka Logging.
I'm having problem configuring the library.

Goal:
This library provides a default JSON formatter. Instead, I'd like to customize it. From my understanding, this is possibile extending the 'FormatterOrLayout', so that its implementation will be injected into "KafkaLogHandlerRecorder".

Problem:
This isn't happening and the application is always logging with default formatter. On startup, this library logs "No formatter or layout for kafka logger provided.", as confirmation that nothing was injected.

Scenario:
In the POM, both dependencies were added:

  • quarkus-logging-kafka
  • quarkus-logging-kafka-deployment
    Since I'm new to Quarkus, I guess that the latter is required to instantiate a "KafkaLogHandlerRecorder" on startup. Ideally, the injection should happen at this stage.

I may be wrong, but the Quarkus documentation (https://quarkus.io/guides/writing-extensions#synthetic_beans( states:

Since the CDI container does not control the instantiation of a synthetic bean the dependency injection and other services (such as interceptors) are not supported. In other words, it’s up to the extension to provide all required services to a synthetic bean instance.

May this be the problem? Is "KafkaLogHandlerRecorder" a "synthetic bean"?

I'd be very grateful for any response.
Have good holidays,
Luca


Could you help me on this? @thescouser89

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions