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

Lightweight Logging API #84478

Open
3 of 19 tasks
ChrisHegarty opened this issue Mar 1, 2022 · 1 comment
Open
3 of 19 tasks

Lightweight Logging API #84478

ChrisHegarty opened this issue Mar 1, 2022 · 1 comment
Assignees
Labels
:Core/Infra/Core Core issues without another label >enhancement Team:Core/Infra Meta label for core/infra team

Comments

@ChrisHegarty
Copy link
Contributor

ChrisHegarty commented Mar 1, 2022

Description

This is a meta-issue tracking subtasks required to introduce a lightweight logging API for use by plugins.

The lightweight logging API offers plugins a stable API upon which to depend. The logging API will facilitate the logging needs of plugins without those plugins depending on any particular third-party library, or server internals. Moreover, any third-party logging library, like say Log4J, will be removed from the class loader hierarchy available to plugins.

The logging API is a small lightweight facade that locates a concrete implementation through an SPI. The logging API is agnostic of any other underlying logging library, like say, Log4J. The implementation however may use Log4J, or another popular logging library. The logging API has no dependency on server, it may however have a dependency on other libs like say, core or x-content (but care must be taken to reduce any dependencies as much as possible).

Stable plugin API

  • Introduce basic usage for stable plugin API Stable logging API - the basic use case #86612
  • Logging api with Messages (ESLogMessage)
  • DeprecationLogger
  • Prefix logger
  • Move log4j off the system classloader (Implement subproject impl which has the log4j dependency)

ES dedicated logging api

  • Logging Bootstrap
  • Creating appenders
  • Examine Logging audit trail

Refactorings

Testing

  • testing - ideally to not rely on log4j. More time consuming tests - EvilLoggerTests, CapturingLogger, JsonLoggerTests
  • LoggerUsageChecker - possibly a refactor and expanding to cover String.format Static analysis tool for String.format #87166
  • MockLogAppender - widely used in our testing. An appender with additional assertion capabilities. THe refactoring can be performed where the log4j appender code is moved into internal implementation and the expectation(asertion) code is within the core/testing package which is part of the exported API.

Bridges

  • SLF4J -> ES_Logging API bridge
  • Log4j -> ES_Logging API bridge (or we can decide to use the log4j<->sl4j bridge

More:

  • Refactor and extrapolate logging configuration in server
@ChrisHegarty ChrisHegarty added >enhancement needs:triage Requires assignment of a team area label labels Mar 1, 2022
@ChrisHegarty ChrisHegarty removed the needs:triage Requires assignment of a team area label label Mar 1, 2022
@rdnm rdnm added the Team:Core/Infra Meta label for core/infra team label Mar 1, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

pgomulka added a commit that referenced this issue Jun 13, 2022
Introducing a stable logging API under libs/logging.
This change covers the most common use cases for logging: fetching a logger with LogManager, emitting a log messages with Logger and Level.
It is influenced by log4j2-api, but do not include Marker and LogBuilder methods.
Also methods using org.apache.logging.log4j.util.Supplier are replaced with java.util.Supplier

The basic implementation is present in server and injected statically in LogConfigurator

relates #84478
@exalate-issue-sync exalate-issue-sync bot reopened this Jun 28, 2022
@rdnm rdnm reopened this Jun 28, 2022
@elasticsearchmachine elasticsearchmachine added needs:triage Requires assignment of a team area label and removed Team:Core/Infra Meta label for core/infra team labels Aug 1, 2022
@nik9000 nik9000 added :Core/Infra/Core Core issues without another label and removed needs:triage Requires assignment of a team area label labels Aug 2, 2022
@elasticsearchmachine elasticsearchmachine added the Team:Core/Infra Meta label for core/infra team label Aug 2, 2022
@rjernst rjernst assigned rjernst and unassigned pgomulka Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Core Core issues without another label >enhancement Team:Core/Infra Meta label for core/infra team
Projects
None yet
Development

No branches or pull requests

7 participants