К сожалению, я не могу заставить работать weblogic, поэтому мне пришлось искать альтернативу.
Вот мое решение, основанное на Logback .
pom.xml
<properties>
<logback.version>1.2.3</logback.version> <!-- Depends on slf4j 1.7.25, conflicting with Weblogic 12.2.1.2 -->
<slf4j.version>1.7.5</slf4j.version> <!-- Shipped with Weblogic 12.2.1.2 -->
<adapter.config.file>/etc/logback-my-resource-adapter.xml</adapter.config.file>
</properties>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
</dependency>
</dependencies>
LoggerHelper.java
package it.sisal.betting.sdg.adapter.sogei.logging;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.util.ContextInitializer;
import org.slf4j.ILoggerFactory;
public class LoggerHelper {
static {
// https://logback.qos.ch/manual/configuration.html
System.setProperty(ContextInitializer.CONFIG_FILE_PROPERTY, "${adapter.config.file}");
}
public static final ILoggerFactory FACTORY = StaticLoggerBinderHack
.getSingleton()
.getLoggerFactory()
;
public static LoggerContext CONTEXT = (LoggerContext)FACTORY;
}
MyResourceAdapter.java
public class MyResourceAdapter implements ResourceAdapter, Serializable {
private static final Logger logger = LoggerHelper
.FACTORY
.getLogger(MyResourceAdapter.class)
;
private BootstrapContext context = null;
@Override
public void start(BootstrapContext context)
throws ResourceAdapterInternalException
{
if (logger.isInfoEnabled()) {
logger.info("start(...)");
}
this.context = context;
}
// And so on...
}