public static Filter getLoggingFilter(final String... requiredPrefixes) {

        // Check sanity
        Validate.notNull(requiredPrefixes, "requiredPrefixes");

        // All done.
        return new Filter() {

            // Internal state
            private List<String> requiredPrefs = Arrays.asList(requiredPrefixes);

            @Override
            public boolean isLoggable(final LogRecord record) {

                final String loggerName = record.getLoggerName();
                for (String current : requiredPrefs) {
                    if (loggerName.startsWith(current)) {
                        return true;
                    }
                }

                // No matches found.
                return false;
            }
        };
    }
public static Filter getLoggingFilter ( final String ... requiredPrefixes ) { Validate . notNull ( requiredPrefixes , "requiredPrefixes" ) ; return new Filter ( ) { private List < String > requiredPrefs = Arrays . asList ( requiredPrefixes ) ; @ Override public boolean isLoggable ( final LogRecord record ) { final String loggerName = record . getLoggerName ( ) ; for ( String current : requiredPrefs ) { if ( loggerName . startsWith ( current ) ) { return true ; } } return false ; } } ; }
Retrieves a java.util.Logging filter used to ensure that only LogRecords whose
logger names start with any of the required prefixes are logged.

@param requiredPrefixes A non-null list of prefixes to be matched with the LogRecord logger names.
@return A java.util.logging Filter that only permits logging LogRecords whose
logger names start with any of the required prefixes.