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

Revamp the Extending, Plugins, Architecture, and Programmatic configuration pages #2716

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

vy
Copy link
Member

@vy vy commented Jul 5, 2024

This incomplete work ports #2696 to main.
The following tasks still need to be done:

  • Adapt plugins.adoc for Log4j 3
    • Artifact has changed
    • Package paths have changed (hence the Javadoc links)
    • There are new annotations: @Namespace, @Category, @PluginOrder, @Ordered, etc.
    • Some annotations are removed: @Order
    • There are no connections between plugins.adoc and dependencyinjection.adoc
  • Revamp dependencyinjection.adoc
    • No Javadoc or source code links
    • Sectioning can be improved to guide the user better
    • Connection with the plugins.adoc can be improved
  • Fix plugin-preliminaries.adoc
  • Fix plugin-related parts (some still refer to category, etc.) of
    • appenders.adoc
    • configuration.adoc
    • extending.adoc
    • filters.adoc
    • layouts.adoc
    • lookups.adoc
    • pattern-layout.adoc

Once #2696 is ported, #2692 and #2715 needs to be ported (in given order) too.

…configuration` pages (#2696)

This work ports 466ac59 to `main`.
@vy vy added the documentation Pull requests or issues that affect documentation label Jul 5, 2024
@vy vy marked this pull request as draft July 5, 2024 14:34
Copy link
Contributor

@ppkarwasz ppkarwasz left a comment

Choose a reason for hiding this comment

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

Sorry, I approved the wrong PR. 😉

I'll add a review later.

Copy link
Member

@jvz jvz left a comment

Choose a reason for hiding this comment

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

Looks good so far! Now I'll look through your TODO list.


Configuration --> Filter

Configuration --> "0..*" Appender
Copy link
Member

Choose a reason for hiding this comment

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

The PlantUML docs have some other relation types you can use here like o-- for aggregation and *-- for composition, though I've used the aggregation relation before to denote when one class has an array or collection of another class. What you've done here, though, is probably easier to understand for people who don't write UML diagrams :)

An overview these major classes can be depicted as follows:

[#architecture-diagram]
.An overview of major classes and their relation
Copy link
Member

Choose a reason for hiding this comment

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

This UML diagram is pretty awesome!


* A <<LoggerContext>>, the composition anchor, gets created in combination with a <<Configuration>>.
Both can be created either directly (i.e., programmatically) or indirectly at first interaction with Log4j.
* `LoggerContext` creates <<Logger>>s that users interact with for logging purposes.
Copy link
Member

Choose a reason for hiding this comment

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

Could be worth mentioning that Logger and LoggerConfig work via a bridge pattern where Logger provides the API and LoggerConfig provides the implementation. This is one key architectural constraint that allows for reconfiguration without dropping any log events being processed at the time of reconfiguration. It's also one of the reasons why many methods of manual configuration of appenders and such is so hard to do properly and why we offer various utility methods and configuration DSLs to sort of hide away the lifecycle handling, concurrency, etc.

src/site/antora/modules/ROOT/pages/manual/layouts.adoc Outdated Show resolved Hide resolved
src/site/antora/modules/ROOT/pages/manual/plugins.adoc Outdated Show resolved Hide resolved
@jvz
Copy link
Member

jvz commented Jul 26, 2024

So far, I've mostly updated the plugins page, but I still have some things to add about order annotations, probably some info about conditional annotations, and a link to the DI page.

@jvz
Copy link
Member

jvz commented Jul 26, 2024

Remaining tasks:

  • Update existing configuration factory plugin classes to use @Ordered instead of @Order.
  • Would be nice if there were a way to still support @Order, though it's in log4j-core, not in log4j-plugins.
  • plugins.adoc should have a section about conditional annotations nearby the validation annotations.
  • plugins.adoc should include info about plugin aliases (which are used for plugin names and plugin attributes).
  • The DI page could still use some structuring for sections.

@ppkarwasz ppkarwasz mentioned this pull request Nov 4, 2024
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Pull requests or issues that affect documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants