jeudi 12 novembre 2020

Avoid org.reflections.Reflections logs: given scan urls are empty. set urls in the configuration etc

When I run any unit test or my application I notice logs:

11:32:36.703 [main] WARN org.reflections.Reflections - given scan urls are empty. set urls in the configuration
11:32:36.731 [main] DEBUG org.reflections.Reflections - going to scan these urls:
file:/C:/Users/Pawel/Documents/s-dmw-pom/s-dmw/target/classes/
11:32:36.835 [main] INFO org.reflections.Reflections - Reflections took 102 ms to scan 1 urls, producing 5 keys and 110 values 
11:32:36.875 [main] WARN org.reflections.Reflections - given scan urls are empty. set urls in the configuration
11:32:36.883 [main] DEBUG org.reflections.Reflections - going to scan these urls:
file:/C:/Users/Pawel/Documents/s-dmw-pom/s-dmw/target/classes/
11:32:36.914 [main] INFO org.reflections.Reflections - Reflections took 31 ms to scan 1 urls, producing 5 keys and 61 values 
11:32:36.929 [main] WARN org.reflections.Reflections - given scan urls are empty. set urls in the configuration
11:32:36.929 [main] DEBUG org.reflections.Reflections - going to scan these urls:
file:/C:/Users/Pawel/Documents/s-dmw-pom/s-dmw/target/classes/
11:32:36.992 [main] INFO org.reflections.Reflections - Reflections took 63 ms to scan 1 urls, producing 7 keys and 149 values 
11:32:36.992 [main] DEBUG org.reflections.Reflections - expanded subtype java.lang.Comparable -> java.lang.Enum
11:32:36.992 [main] DEBUG org.reflections.Reflections - expanded subtype java.io.Serializable -> java.lang.Enum
...

I read that those logs are produced by java org.reflections.Reflections:

Reflections.scan()

protected void scan() {
  if (configuration.getUrls() == null || configuration.getUrls().isEmpty()) {
    if (log != null) log.warn("given scan urls are empty. set urls in the configuration");
    return;

    log.debug("going to scan these urls:\n{}", Joiner.on("\n").join(configuration.getUrls()));

  ExecutorService executorService = configuration.getExecutorService();
  List<Future<?>> futures = Lists.newArrayList();

  for (final URL url : configuration.getUrls()) {
    try {
      if (executorService != null) {

And they are invoked when setUrls(null):

Reflections reflections = new Reflections(new ConfigurationBuilder()
      .setUrls(...)));

How to avoid them?





Aucun commentaire:

Enregistrer un commentaire