@Plugin(name="DataSource",
category="Core",
elementType="connectionSource",
printObject=true)
public final class DataSourceConnectionSource
extends org.apache.logging.log4j.core.appender.db.jdbc.AbstractConnectionSource
JdbcAppender connection source that uses a DataSource to connect to the database.
PaxLogging changes: more dynamic approach to JNDI.
The idea is to be able to configure JNDI datasource for Log4J2 JDBC appender in situations where
both JNDI (aries-jndi) and DataSource service itself may dynamically come and go to/from OSGi registry.| Modifier and Type | Method and Description |
|---|---|
static DataSourceConnectionSource |
createConnectionSource(String jndiName,
String serviceFilter,
boolean lazy)
Factory method for creating a connection source within the plugin manager.
|
Connection |
getConnection() |
void |
stop() |
String |
toString() |
equalsImpl, getState, getStatusLogger, hashCodeImpl, initialize, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, start, stop, stoppublic void stop()
stop in interface org.apache.logging.log4j.core.LifeCyclestop in class org.apache.logging.log4j.core.AbstractLifeCyclepublic Connection getConnection() throws SQLException
SQLExceptionpublic String toString()
@PluginFactory public static DataSourceConnectionSource createConnectionSource(@PluginAttribute(value="jndiName") String jndiName, @PluginAttribute(value="service") String serviceFilter, @PluginAttribute(value="lazy") boolean lazy)
jndiName - The full JNDI path where the data source is bound. Should start with java:/comp/env or
environment-equivalent.serviceFilter - Filter definition to get DataSource directly
from OSGi registry without JNDIlazy - whether we should create lazy ConnectionSource that's more tolerant to missing
JNDI and/or actual bound DataSource.Copyright © 2006–2021 OPS4J - Open Participation Software for Java. All rights reserved.