Set the level of output log in spark applications

When running spark will generate a lot of news, so the program looks more strenuous operating results

So you can add some code to another program, set about the level of the output log

1 import org.apache.log4j.{Level, Logger}
2 
3 object Example {
4   Logger.getLogger("org").setLevel(Level.ERROR)
5 
6   def main(args: Array[String]) {
7     ......
8   }
9 }

Level code where parameters can be set to WARN, or ERROR, that according to their needs

Directly to ERROR might miss some of the more important warning information, but the contents of this output is also less, you can directly see the results

Guess you like

Origin www.cnblogs.com/zhuangbijingdeboke/p/11580377.html