Reputation: 8917
When I am testing my class, application writes lots of stuff to the console, because of logging (I am using SLF4J). How do I disable logging in this case, without introducing special flag inside tested class?
Upvotes: 0
Views: 1129
Reputation: 7646
SLF4J is only a facade, meaning that it does not provide a complete logging solution, so if you are using it with LOG4J just change your logging level to OFF. For more info see https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html#OFF
So you can have two log4j.xml configuration files, one for production and one for testing with logging level set to OFF or better to WARN.
Upvotes: 1