Skip to content

Add support for log4j2 composite configuration #27110

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

Closed
quaff opened this issue Jun 28, 2021 · 5 comments
Closed

Add support for log4j2 composite configuration #27110

quaff opened this issue Jun 28, 2021 · 5 comments
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@quaff
Copy link
Contributor

quaff commented Jun 28, 2021

https://logging.apache.org/log4j/2.x/manual/configuration.html#CompositeConfiguration

Here is my use case, I want output logs to ELK in production, so I add extra log4j2-kafka-appender.xml beside log4j2.xml.
I need merge two files without composite configuration supports, which will make configuration redundant.

logging:
  config: classpath:log4j2.xml

---
spring:
  config.activate.on-profile: prod
logging:
  config: classpath:log4j2.xml,classpath:log4j2-kafka-appender.xml
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 28, 2021
@wilkinsona
Copy link
Member

Thanks for the suggestion. Supporting a comma-separated list and turning that into a CompositeConfiguration looks pretty straightforward. One thing that I'm not completely sure about is having logging.config (which is logging system agnostic) support a Log4j2-specific feature. I think it's ok as it's passed into the various logging systems as a string that they can then interpret as needed, but I'd like to see what the rest of the team thinks.

@wilkinsona wilkinsona added for: team-attention An issue we'd like other members of the team to review type: enhancement A general enhancement labels Jul 10, 2021
@snicoll
Copy link
Member

snicoll commented Jul 11, 2021

I am not keen to see such loose use of a property that's logging system agnostic. It's tricky because creating a specific property will create another set of issues.

@philwebb
Copy link
Member

We could support a logging.log4j2.config.override property that could be a List of additional configs. This mirrors the override property discussed in the "Composite Configuration" section of the manual.

@philwebb philwebb added status: reserved-for-conference-event and removed 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 labels Jul 12, 2021
@philwebb philwebb added this to the 2.6.x milestone Jul 12, 2021
@wilkinsona wilkinsona changed the title Add supports for log4j2 composite configuration Add support for log4j2 composite configuration Jul 16, 2021
@scottfrederick scottfrederick added status: first-timers-only An issue that can only be worked on by brand new contributors and removed status: reserved-for-conference-event labels Sep 1, 2021
@mbhave mbhave added status: reserved-for-conference-event and removed status: first-timers-only An issue that can only be worked on by brand new contributors labels Oct 1, 2021
@GayathiriRuthraiyah
Copy link

GayathiriRuthraiyah commented Oct 1, 2021

I will be working on this issue

@rgoers
Copy link
Contributor

rgoers commented Nov 22, 2021

I just saw this issue as I noticed the change in the latest source code.

I should point out that Log4j already provided support for this in its log4j-spring-boot module. In addition, the support that was implemented here doesn't support http(s) connections that require authentication which log4j-spring-boot does. I'd be more than happy to be able to remove log4j-spring-boot once Spring Boot provides the equivalent functionality.

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

No branches or pull requests

10 participants