use of org.eclipse.persistence.logging.DefaultSessionLog in project eclipselink by eclipse-ee4j.
the class FailoverBase method prepare.
@Before
public void prepare() {
DatabaseLogin login = new DatabaseLogin();
login.useDirectDriverConnect();
login.setDriverClass(EmulatedDriver.class);
login.setConnectionString("jdbc:emulateddriver");
login.getPlatform().setPingSQL("SELECT 1");
Project p = new Project(login);
ClassDescriptor cd = Address.descriptor();
p.addDescriptor(cd);
session = createSession(p);
SessionLog log = new DefaultSessionLog(new OutputStreamWriter(System.out));
int logLevel = AbstractSessionLog.translateStringToLoggingLevel(System.getProperty(PersistenceUnitProperties.LOGGING_LEVEL, "INFO"));
session.setSessionLog(log);
session.setLogLevel(logLevel);
session.login();
// this will actually store the results on the driver for subsequent connections.
EmulatedConnection con = (EmulatedConnection) ((DatabaseSessionImpl) session).getAccessor().getConnection();
Vector<DatabaseField> pingFields = new Vector<DatabaseField>() {
{
add(new DatabaseField("1"));
}
};
con.putRows("SELECT 1", new Vector() {
{
add(new ArrayRecord(pingFields, pingFields.toArray(new DatabaseField[0]), new Object[] { "1" }));
}
});
con.putRows(Address.getSQL(), Address.getData(cd));
}
use of org.eclipse.persistence.logging.DefaultSessionLog in project eclipselink by eclipse-ee4j.
the class SessionsFactory method buildDefaultSessionLogConfig.
/**
* INTERNAL:
* Wrapped by the getSessionLog() call, therefore, config can't be null at
* this point.
*/
protected SessionLog buildDefaultSessionLogConfig(DefaultSessionLogConfig defaultSessionLogConfig) {
DefaultSessionLog defaultSessionLog = new DefaultSessionLog();
// Log level - XML Schema default is info
defaultSessionLog.setLevel(m_logLevels.get(defaultSessionLogConfig.getLogLevel()));
// Filename - setWriter will handle nulls
defaultSessionLog.setWriter(defaultSessionLogConfig.getFilename());
// Process the common elements from LogConfig
processLogConfig(defaultSessionLogConfig, defaultSessionLog);
return defaultSessionLog;
}
use of org.eclipse.persistence.logging.DefaultSessionLog in project eclipselink by eclipse-ee4j.
the class MessageLoggingEfficiencyTest method setup.
@Override
public void setup() {
caughtException = null;
oldLog = getSession().getSessionLog();
DefaultSessionLog newLog = new DefaultSessionLog();
newLog.setLevel(SessionLog.FINE);
getSession().setSessionLog(newLog);
}
use of org.eclipse.persistence.logging.DefaultSessionLog in project eclipselink by eclipse-ee4j.
the class FieldedMessageLoggingTest method setup.
@Override
public void setup() {
caughtException = null;
oldLog = getSession().getSessionLog();
DefaultSessionLog newLog = new DefaultSessionLog();
newLog.setLevel(SessionLog.FINE);
getSession().setSessionLog(newLog);
}
use of org.eclipse.persistence.logging.DefaultSessionLog in project eclipselink by eclipse-ee4j.
the class FieldedMessageLoggingTraceLocalizationTest method setup.
@Override
public void setup() {
caughtException = null;
oldLog = getSession().getSessionLog();
DefaultSessionLog newLog = new DefaultSessionLog();
newLog.setLevel(SessionLog.FINE);
getSession().setSessionLog(newLog);
}
Aggregations