IDEMPIERE-2892:add config let out put log of c3p0
This commit is contained in:
parent
3c1199f5bf
commit
fc67e3d668
|
@ -11,7 +11,8 @@ Bundle-ClassPath: .,
|
|||
c3p0-0.9.5-pre9.jar,
|
||||
c3p0-oracle-thin-extras-0.9.5-pre9.jar,
|
||||
mchange-commons-java-0.2.8.jar
|
||||
Import-Package: org.osgi.framework
|
||||
Import-Package: org.osgi.framework,
|
||||
org.slf4j;version="1.7.2"
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-Activator: org.adempiere.db.oracle.OracleBundleActivator
|
||||
Service-Component: OSGI-INF/oracleprovider.xml
|
||||
|
|
|
@ -15,3 +15,4 @@ MaxStatementsPerConnection=30
|
|||
TestConnectionOnCheckin=false
|
||||
TestConnectionOnCheckout=false
|
||||
#CheckoutTimeout=60;
|
||||
com.mchange.v2.log.MLog=com.mchange.v2.log.slf4j.Slf4jMLog
|
|
@ -661,10 +661,11 @@ public class DB_Oracle implements AdempiereDatabase
|
|||
int unreturnedConnectionTimeout = getIntProperty(poolProperties, "UnreturnedConnectionTimeout", 0);
|
||||
boolean testConnectionOnCheckin = getBooleanProperty(poolProperties, "TestConnectionOnCheckin", false);
|
||||
boolean testConnectionOnCheckout = getBooleanProperty(poolProperties, "TestConnectionOnCheckout", false);
|
||||
String mlogClass = getStringProperty(poolProperties, "com.mchange.v2.log.MLog", "com.mchange.v2.log.FallbackMLog");
|
||||
int checkoutTimeout = getIntProperty(poolProperties, "CheckoutTimeout", 0);
|
||||
try
|
||||
{
|
||||
System.setProperty("com.mchange.v2.log.MLog", "com.mchange.v2.log.FallbackMLog");
|
||||
System.setProperty("com.mchange.v2.log.MLog", mlogClass);
|
||||
//System.setProperty("com.mchange.v2.log.FallbackMLog.DEFAULT_CUTOFF_LEVEL", "ALL");
|
||||
ComboPooledDataSource cpds = new ComboPooledDataSource();
|
||||
cpds.setDataSourceName("iDempiereDS");
|
||||
|
@ -1320,6 +1321,19 @@ public class DB_Oracle implements AdempiereDatabase
|
|||
return b;
|
||||
}
|
||||
|
||||
private String getStringProperty(Properties properties, String key, String defaultValue)
|
||||
{
|
||||
String b = defaultValue;
|
||||
try
|
||||
{
|
||||
String s = properties.getProperty(key);
|
||||
if (s != null && s.trim().length() > 0)
|
||||
b = s.trim();
|
||||
}
|
||||
catch(Exception e){}
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean forUpdate(PO po, int timeout) {
|
||||
//only can lock for update if using trx
|
||||
|
|
|
@ -12,7 +12,8 @@ Require-Bundle: org.adempiere.base;bundle-version="3.0.0",
|
|||
org.adempiere.install;bundle-version="3.0.0"
|
||||
Import-Package: junit.framework;version="3.8.2",
|
||||
org.junit;version="4.8.1",
|
||||
org.osgi.framework
|
||||
org.osgi.framework,
|
||||
org.slf4j;version="1.7.2"
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-Activator: org.adempiere.db.postgresql.PostgreSQLBundleActivator
|
||||
Service-Component: OSGI-INF/pgprovider.xml
|
||||
|
|
|
@ -16,3 +16,4 @@ MaxStatementsPerConnection=30
|
|||
TestConnectionOnCheckin=false
|
||||
TestConnectionOnCheckout=false
|
||||
#CheckoutTimeout=60;
|
||||
com.mchange.v2.log.MLog=com.mchange.v2.log.slf4j.Slf4jMLog
|
|
@ -753,11 +753,13 @@ public class DB_PostgreSQL implements AdempiereDatabase
|
|||
int unreturnedConnectionTimeout = getIntProperty(poolProperties, "UnreturnedConnectionTimeout", 0);
|
||||
boolean testConnectionOnCheckin = getBooleanProperty(poolProperties, "TestConnectionOnCheckin", false);
|
||||
boolean testConnectionOnCheckout = getBooleanProperty(poolProperties, "TestConnectionOnCheckout", false);
|
||||
String mlogClass = getStringProperty(poolProperties, "com.mchange.v2.log.MLog", "com.mchange.v2.log.FallbackMLog");
|
||||
|
||||
int checkoutTimeout = getIntProperty(poolProperties, "CheckoutTimeout", 0);
|
||||
|
||||
try
|
||||
{
|
||||
System.setProperty("com.mchange.v2.log.MLog", "com.mchange.v2.log.FallbackMLog");
|
||||
System.setProperty("com.mchange.v2.log.MLog", mlogClass);
|
||||
//System.setProperty("com.mchange.v2.log.FallbackMLog.DEFAULT_CUTOFF_LEVEL", "ALL");
|
||||
ComboPooledDataSource cpds = new ComboPooledDataSource();
|
||||
cpds.setDataSourceName("iDempiereDS");
|
||||
|
@ -1049,6 +1051,19 @@ public class DB_PostgreSQL implements AdempiereDatabase
|
|||
return b;
|
||||
}
|
||||
|
||||
private String getStringProperty(Properties properties, String key, String defaultValue)
|
||||
{
|
||||
String b = defaultValue;
|
||||
try
|
||||
{
|
||||
String s = properties.getProperty(key);
|
||||
if (s != null && s.trim().length() > 0)
|
||||
b = s.trim();
|
||||
}
|
||||
catch (Exception e) {}
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean forUpdate(PO po, int timeout) {
|
||||
//only can lock for update if using trx
|
||||
|
|
Loading…
Reference in New Issue