Class LoggersResource

All Implemented Interfaces:
BasicUniversalConfig, DefaultConfig, DefaultHtmlConfig

public class LoggersResource extends BasicRestResource
Child-resource flavor of the /loggers runtime log-level management endpoint.

Mounts as a routed child via @Rest(children=LoggersResource.class) under the subtree /loggers and delegates to a shared LoggersManager worker — the same logic the mixin flavor uses, so the two forms cannot drift. Extends BasicRestResource so the returned beans serialize via the BasicUniversalConfig set (mirrors HealthResource).

As with the mixin flavor, the GET endpoints carry no built-in guard of their own — mount this resource only under a subtree that's already covered by whatever authentication/authorization the app applies to its management endpoints generally. See LoggersMixin for details.

Backend:
See Also:
Since:
10.0.0
  • Constructor Details

  • Method Details

    • getLoggers

      [GET /] - All loggers and their configured levels.
      Returns:
      A sorted map of logger name to configured level (empty string = inherited).
    • getLogger

      public String getLogger(RestRequest req, @Path("name") String name)
      [GET /{name}] - One logger's configured level.
      Parameters:
      req - The HTTP request.
      name - The logger name ("ROOT" for the root logger).
      Returns:
      The configured level name, empty string if inherited.
      Throws:
      NotFound - If no logger with that name is registered.
    • setLogger

      public String setLogger(RestRequest req, @Path("name") String name, @Content String level)
      [PUT /{name}] - Set a logger's level at runtime.

      Sensitive (mutating) — deny-by-default: responds 403 unless a LoggersSettings bean with writes enabled is registered.

      Parameters:
      req - The HTTP request.
      name - The logger name ("ROOT" for the root logger).
      level - The level name (e.g. FINE, INFO, OFF), or blank to inherit from the ancestor.
      Returns:
      The newly-configured level (empty string if inherited).
      Throws:
      Forbidden - If the set-level endpoint is not enabled.
    • setLoggerPost

      public String setLoggerPost(RestRequest req, @Path("name") String name, @Content String level)
      [POST /{name}] - Set a logger's level at runtime (POST alias of setLogger(RestRequest,String,String)).
      Parameters:
      req - The HTTP request.
      name - The logger name ("ROOT" for the root logger).
      level - The level name, or blank to inherit.
      Returns:
      The newly-configured level (empty string if inherited).
      Throws:
      Forbidden - If the set-level endpoint is not enabled.