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

Uniform handling of location and URIs #2537

Open
ppkarwasz opened this issue Apr 29, 2024 · 1 comment
Open

Uniform handling of location and URIs #2537

ppkarwasz opened this issue Apr 29, 2024 · 1 comment
Labels
enhancement Additions or updates to features

Comments

@ppkarwasz
Copy link
Contributor

Many Log4j components use URI-sh configuration attributes:

  • configuration factories allow a ConfigurationSource to be specified as URI, URL or file name,
  • the MutableThreadContextMapFilter accepts an URI or file name to retrieve its configuration,
  • JSON Template Layout accepts an URI to retrieve its configuration.

Each of these configuration attributes is handled in a different way. For example:

  • JTL only handles file: and classpath: URIs,
  • the way URIs without a schema are interpreted differs.

We should introduce an abstraction similar to ResourceLoader that:

  • supports at least the classpath, file, http and https protocols,
  • is extensible to new protocol handlers,
  • specifies how a relative URI without a protocol needs to be interpreted. This mechanism should be extensible: e.g. a standard implementation could interpret it as classpath or file resources. A log4j-web specific implementation could interpret it as war, classpath or file resource,
  • has a coherent way to handle errors: file names and Java URLs don't always follow the URI syntax.

Remark: other Log4j components might also profit from this abstraction. For example the File appender could be easily adapted to use network filesystem URIs or at least it should be able to use NIO file systems.

@vy vy added the enhancement Additions or updates to features label Apr 29, 2024
@vy
Copy link
Member

vy commented Apr 29, 2024

I wrote JTLs Uris class you mentioned before JTL became a part of the Log4j. Hence, I can totally relate to the absence of this resource loading mechanism and I fully support the idea of introducing such a mechanism. 💯

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

No branches or pull requests

2 participants