Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JustNello opened this issue Dec 23, 2022 · 2 comments
Open

Comments

@JustNello
Copy link

JustNello commented Dec 23, 2022

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

@thescouser89
Copy link
Contributor

Hi Luca! Apologies for the huge delay. I'll look into this and get back to you hopefully soon.

@thescouser89
Copy link
Contributor

thescouser89 commented Jan 18, 2023

I might be misreading the doc but it looks like we can only customize what an extension injects, not what we can inject into an extension? I'll ask around.

Edit: asked in: https://quarkusio.zulipchat.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants