Class LogManagerUtil

java.lang.Object
com.aoapps.hodgepodge.logging.LogManagerUtil

public final class LogManagerUtil extends Object
LogManager has several methods that would be very useful in setting up logging, but they are package-private. This implements the same set of methods here.

This first tries to access to private methods directly through Method.setAccessible(boolean), which might give up-to-date implementations. When this fails, uses an implementation copied here from Java 1.8.0_231.

Author:
AO Industries, Inc.
See Also:
  • Method Details

    • getStringProperty

      public static String getStringProperty(LogManager manager, String name, String defaultValue)
      Package private method to get a String property. If the property is not defined we return the given default value.
    • getLevelProperty

      public static Level getLevelProperty(LogManager manager, String name, Level defaultValue)
      Package private method to get a Level property. If the property is not defined or cannot be parsed we return the given default value.
    • getFilterProperty

      public static Filter getFilterProperty(LogManager manager, String name, Filter defaultValue)
      Package private method to get a filter property. We return an instance of the class named by the "name" property. If the property is not defined or has problems we return the defaultValue.
    • getFormatterProperty

      public static Formatter getFormatterProperty(LogManager manager, String name, Formatter defaultValue)
      Package private method to get a formatter property. We return an instance of the class named by the "name" property. If the property is not defined or has problems we return the defaultValue.