1
我需要閱讀的src /資源的自定義log4j.properties,這是行不通的log4j屬性文件中捆綁入火花應用罐子被忽略
try{
val inStream :InputStream= className.this.getClass.getClassLoader.getResourceAsStream("log4j.properties");
logCfgProps.load(inStream)
} catch {
case e: Throwable=>
e.printStackTrace()
log.error("log.properties file not present")
}
PropertyConfigurator.configure(logCfgProps)
這意味着在罐子捆綁log4j的被忽略。
我無法觸及spark home中conf目錄下的log4j屬性。
還有什麼其他的選擇?
編輯 一定有什麼地方錯了(在類路徑?) 因爲這樣做
val resource:URL = Thread.currentThread().getContextClassLoader()
.getResource("log4j.properties");
System.out.println("resource = " + resource);
它指向的conf目錄下的log4j的,我不能修改,而我需要忽略。
如何做到這一點?