Turn Off Apache Common Logging

As others have pointed out, this is happening because you create the Log object before you set the property.

One way around this would be to set the property in your Main class’ static initialiser block – this will be run when the class is first loaded, and before the static final Log is created:

public class Main {

   static {
      System.setProperty("org.apache.commons.logging.Log",
                         "org.apache.commons.logging.impl.NoOpLog");
   }

   // Rest of class as before
}

Leave a Comment