Here I am using Weblogic 12c Server to deploy my web application. In my application I'm using OCI JAVA SDK to interact with Oracle Cloud Infrastructure(OCI) Service. As per the documentation by OCI, "OCI JAVA SDK" is using SLF4J logging. So that I've bundled "slf4j-jdk14-1.7.23.jar" JAR file in my ear file. Still I was not able to see the OCI SDK generated logs in the weblogic log files.
I've added the below entries in weblogic-application.xml as well:
<prefer-application-packages>
<package-name>org.slf4j.*</package-name>
</prefer-application-packages>
<!-- if not using prefer-application-resources you will get a warning like this: -->
<!-- Class path contains multiple SLF4J bindings -->
<!-- SLF4J: Found binding in [jar:file:/C:/wls1211/modules/org.slf4j.jdk14_1.6.1.0.jar!/org/slf4j/impl/StaticLoggerBinder.class] -->
<prefer-application-resources>
<resource-name>org/slf4j/impl/StaticLoggerBinder.class</resource-name>
</prefer-application-resources>
After adding the above entries, "StaticLoggerBinder" class not found errors are resolved. But still not able to see the SDK generated log statements in weblogic log files.
Am I missing any specific configuration ?
Unfortunately, I don't have any experience with Weblogic, but I tried configuring "JDK14"-style logging from the command line, hoping that it will help you.
As an example, I'm using PaginationExample.java, which is in the
examples
directory of theoci-java-sdk.zip
file that you can download from the releases page.I have unpacked the
oci-java-sdk.zip
file, changed into theexamples
directory and compiled thePaginationExample.java
file:Now I have a
PaginationExample.class
file in the current directory.I also downloaded the slf4j-1.7.23.zip file and unpacked it. For me, the JDK logging bridge file is
../../slf4j-1.7.23/slf4j-jdk14-1.7.23.jar
.I can now write a
logging.properties
file to configure JDK14 logging, e.g.:Now I can run the example using:
java -Djava.util.logging.config.file=logging.properties -cp ../lib/oci-java-sdk-full-1.2.38.jar:../third-party/lib/*:../../slf4j-1.7.23/slf4j-jdk14-1.7.23.jar:. PaginationExample <tenancy ocid>
With the above
logging.properties
file, output, down to theFINE
level (which isDEBUG
in slf4j terminology) goes both to console and to a file.This works on the command line. It sounds like WebLogic is using the JDK14
java.util.logging
framework, and we need to get slf4j to feed into that. You're already doing what was recommended here.Since the above configuration works for console and file, I'm wondering if the [server logging bridge](https://docs.oracle.com/middleware/1212/wls/WLLOG/logging_services.htm#WLLOG200 ) isn't configured correctly.
This page seems to describe how to do that: http://buttso.blogspot.com/2011/06/using-slf4j-with-weblogic-server.html