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

Support custom appenders with structured logging #44235

Open
DarkAtra opened this issue Feb 11, 2025 · 1 comment
Open

Support custom appenders with structured logging #44235

DarkAtra opened this issue Feb 11, 2025 · 1 comment
Labels
for: team-attention An issue we'd like other members of the team to review status: waiting-for-triage An issue we've not yet triaged

Comments

@DarkAtra
Copy link

DarkAtra commented Feb 11, 2025

At my company we currently maintain a custom starter that support logging to console, file, a kafka topic and an http endpoint. However, the current setup heavily relies on custom configuration via logback-spring.xml and also uses if conditions which requires janino and thus is not compatible with GraalVM native image. With the latest spring boot release, we successfully switched our console and file logging over to the new structured logging feature but still have to maintain our "old" starter for logging to kafka and an http endpoint. Our goal is to have full compatability with GraalVM in the future, so we're actively looking for solutions here.

Would it be possible to allow users of spring to define additional appenders for structured logging in DefaultLogbackConfiguration#apply so that we can basically re-use the whole formatting logic or would you recommend a different approach?

Probably related to:

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 11, 2025
@philwebb
Copy link
Member

Currently both LogbackConfigurator and DefaultLogbackConfiguration are package private and I don't think we'd really want to make them public if we can at all help it.

I don't have a lot of good ideas to suggest, but perhaps we could add a hook point in org.springframework.boot.logging.logback.LogbackLoggingSystem.loadDefaults(LoggingInitializationContext, LogFile) that could delegate to something loaded from spring.factories. You could at least then copy/paste our initialization code to do what you need. I'm not sure if such an approach would help or hinder future efforts to fix #25847.

Flagging to see what the rest of the team think.

@philwebb philwebb added the for: team-attention An issue we'd like other members of the team to review label Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: team-attention An issue we'd like other members of the team to review status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

No branches or pull requests

3 participants