Skip to content

apache/logging-admin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

This repository contains an initial sketch of an Apache Logging Admin API. See the ["New API for log level manipulation" thread](https://lists.apache.org/thread/ktdlo5br6jc39xo33vdsfsj2s200mm93) for more details.

The purpose of the API is to allow the programmatic configuration of the logging backend in an implementation independent way.

import org.apache.logging.admin.LoggingAdmin;

public final class Main {
  private static final Object TOKEN = new Object();

  public static void main(String[] args) {
    int i = 0;
    while (i < args.length) {
      if ("--logLevel".equals(args[i]) && ++i < args.length) {
        LoggingAdmin admin = LoggingAdmin.getInstance(TOKEN);
        admin.setLevel("", args[i]);
      }
      i++;
    }
  }
}