SLING-13224 - Allow configuring which loggers the LogStore captures

LogStoreRegistrar hard-coded the LogStoreAppender's "loggers" service
property to "ROOT", so the in-memory store only captured events that
propagate to ROOT. Loggers configured with additivity=false (log.request,
log.access, audit logs, etc.) never reached it.

Add an optional "loggers" property on the existing
org.apache.sling.commons.log.LogStore PID (default ["ROOT"], preserving
today's behaviour). LogStoreRegistrar parses it via the OSGi Converter
and uses it as the appender service property, so AppenderTracker attaches
the store to each named logger. Reconfiguration is hot: changing the
property invokes setProperties on the existing registration and
AppenderTracker.modifiedService re-attaches.

Example org.apache.sling.commons.log.LogStore.cfg.json:

  {
      "maxEntries:Integer": 10000,
      "loggers": ["ROOT", "log.request", "log.access"]
  }

Additive change: configurations that don't set "loggers" get the
historical ["ROOT"] default. No public API change.
2 files changed
tree: 13a007be2ff534eae3a3afd4388f46e94e99164e
  1. src/
  2. .asf.yaml
  3. .gitignore
  4. .sling-module.json
  5. CODE_OF_CONDUCT.md
  6. CONTRIBUTING.md
  7. Jenkinsfile
  8. LICENSE
  9. pom.xml
  10. README.md
README.md

Apache Sling

Build Status Test Status Coverage Sonarcloud Status JavaDoc License

Apache Sling Commons Log

This module is part of the Apache Sling project.

The “log” module provides some useful extension to the default Logback feature set to enable better integration with OSGi.

Installation

The Logging bundle should be installed as one of the first modules in the OSGi framework and - provided the framework supports start levels - be set to start at start level 1. This ensures the Logging bundle is loaded as early as possible thus providing services to the framework and preparing logging.

For more details refer to the Logging Documentation

Getting Started

You can compile and package the jar using the following command:

mvn package