log4j properties file bundled into jar in spark app is ignored

前端 未结 1 1332
臣服心动
臣服心动 2021-01-15 21:47

I need to read a custom log4j.properties from src/resources and this is not working

try{
  val  inStream :InputStream= className.this.getClass.getClassLoader         


        
相关标签:
1条回答
  • 2021-01-15 22:01
    1. You can just give another name to your file (and using it in the code as well), so there is no conflict with conf/log4j.properties.

    2. You can get all resources with the given name on the classpath using ClassLoader.getResources("log4j.properties") and choose which one you want.

    0 讨论(0)
提交回复
热议问题