Es wäre schön gewesen, die Protokollierung zu steuern nur logging.properties
mit:
org = FINE
com = SEVERE
Leider muss das entsprechende Protokoll tatsächlich erstellt wurden. Wenn Sie Ihre Konfigurationsdatei ändern, funktioniert das nicht für Sie. In den Loggern selbst und es wird funktionieren:
private static final Logger ORG_ROOT_LOGGER = Logger.getLogger("org");
private static final Logger COM_ROOT_LOGGER = Logger.getLogger("com");
Nested-Logger in der Anwendung auf die gleiche Weise arbeiten:
# perhaps in the main entry point for your application?
private static final Logger APP_ROOT_LOGGER = Logger.getLogger("com.myapp");
# in each package or class you want to have separately controlled loggers
private static final Logger LOG = Logger.getLogger(HelloWorldApp.class.getName());
# in logging.properties
com.myapp.level = FINE # sufficient to make all your loggers log as FINE
com.myapp.HelloWorldApp.level = SEVERE # turn off msgs from that particularly chatty app