Prevent Weblogic 12c from using system's slf4j binding

后端 未结 4 1723
再見小時候
再見小時候 2020-12-07 23:48

We\'re building new systen using slf4j as logging facade. When deploying on newly Weblogic 12c, we found this error on console log:

SLF4J: Class path contain         


        
4条回答
  •  轮回少年
    2020-12-08 00:20

    We were also having this issue and since we are required to configure the logging using Log4J this was an issue. However, using prefer-application-packages seems to work so far, i.e. putting a weblogic-application.xml file in the META-INF folder of the EAR with the following:

    
    
        
            org.slf4j
        
    
    

    (ok the specified xmlns is an old one but it works, you may update it if you want, I just took ours and removed the unrelated parts).

    We still have the aforementioned warning but it uses Log4J as required. In fact, if you look at the URL specified on the next line in the logs (omitted here in the question), it says:

    The warning emitted by SLF4J is just that, a warning. SLF4J will still bind with the first framework it finds on the class path.

    So I guess it still uses the normal class-loading mechanism for loading org.slf4j.impl.StaticLoggerBinder, which we actually configured to prefer the one in our EAR (i.e. make it the first on the classpath).

    Yet, the warning remains but it works. Fixing the warning would be good but probably not possible without altering WebLogic's provided libraries.

提交回复
热议问题