Skip to content

Create DefaultLayout independent of PatternLayout #3118

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

Merged
merged 4 commits into from
Oct 25, 2024

Conversation

ppkarwasz
Copy link
Contributor

Currently, PatternLayout and all its patterns are a required element of Log4j Core, since DefaultConfiguration uses it. The default configuration is used in all Log4j Core installation as failsafe to handle logging between the time a logger context is created and the real configuration starts (a couple of ms).

This PR creates a simple hardcoded layout to use with DefaultConfiguration.

Currently, `PatternLayout` and all its patterns are a required element of Log4j Core, since `DefaultConfiguration` uses it.
The default configuration is used in all Log4j Core installation as failsafe to handle logging between the time a logger context is created and the real configuration starts (a couple of ms).

This PR creates a simple hardcoded layout to use with `DefaultConfiguration`.
@vy vy added the layouts Affects one or more Layout plugins label Oct 24, 2024
@vy vy added this to the 2.25.0 milestone Oct 24, 2024
Copy link
Member

@vy vy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the idea @ppkarwasz! 💯

ppkarwasz and others added 2 commits October 25, 2024 09:13
Co-authored-by: Volkan Yazıcı <volkan@yazi.ci>
@ppkarwasz ppkarwasz merged commit e8d5ffc into 2.x Oct 25, 2024
9 checks passed
@ppkarwasz ppkarwasz deleted the feature/2.x/default-layout branch October 25, 2024 10:16
@ppkarwasz ppkarwasz mentioned this pull request Nov 4, 2024
23 tasks
ppkarwasz added a commit that referenced this pull request Apr 1, 2025
Currently, `PatternLayout` and all its patterns are a required element of Log4j Core, since `DefaultConfiguration` uses it.
The default configuration is used in all Log4j Core installation as failsafe to handle logging between the time a logger context is created and the real configuration starts (a couple of ms).

This PR creates a simple hardcoded layout to use with `DefaultConfiguration`, based on the `StatusData` formatter.

(cherry picked from commit e8d5ffc)

Co-authored-by: Piotr P. Karwasz <piotr.github@karwasz.org>
Co-authored-by: Volkan Yazıcı <volkan@yazi.ci>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
layouts Affects one or more Layout plugins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants