I have certain packages (Mainly from external jars) that I'd like to disable there logging.
I am using:
import org.slf4j.Lo开发者_StackOverflowgger;
import org.slf4j.LoggerFactory;
for my logging.
Thanks
Please note that slf4j is only a logging facade to the actual logging mechanism (such as commons logging, logback or log4j). So, you need to look out for the configurations of the actual logging mechanism you are using.
You could increase the log level of those packages to ERROR or WARN, to hide them from usual INFO/DEBUG logging.
Setup a category, like this (from our log4j.xml):
<category name="javax">
<priority value="INFO" />
</category>
This only logs INFO messages and above from all javax.*
packages.
You could also set the priority to FATAL
in order to only get the most critical messages, which should be none (hopefully).
First identify what these external jars use for logging, either by looking at their documentation, or looking into the source code (if it's available). The fact that you use slf4j with log4j may have nothing to do with it, esp. if they log directly to some other logging implementation.
精彩评论