Java Code Examples for org.eclipse.persistence.logging.SessionLog#FINE

The following examples show how to use org.eclipse.persistence.logging.SessionLog#FINE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EclipseLinkOSGiSessionLogger.java    From lb-karaf-examples-jpa with Apache License 2.0 6 votes vote down vote up
/**
 *
 */
@Override
public void log(SessionLogEntry sle) {
    Logger lg  = getLogger(sle);
    String msg = getMessage(sle);

    if(lg != null && StringUtils.isNotBlank(msg)) {
        switch(sle.getLevel()) {
            case SessionLog.SEVERE  : lg.error(msg); break;
            case SessionLog.WARNING : lg.warn (msg); break;
            case SessionLog.INFO    : lg.info (msg); break;
            case SessionLog.FINE    : lg.debug(msg); break;
            case SessionLog.FINER   : lg.trace(msg); break;
            case SessionLog.FINEST  : lg.trace(msg); break;
            case SessionLog.ALL     : lg.trace(msg); break;
            default                 : lg.debug(msg); break;
        }
    }
}
 
Example 2
Source File: EclipseLinkOSGiSessionLogger.java    From lb-karaf-examples-jpa with Apache License 2.0 6 votes vote down vote up
/**
 *
 */
@Override
public void log(SessionLogEntry sle) {
    Logger lg  = getLogger(sle);
    String msg = getMessage(sle);

    if(lg != null && StringUtils.isNotBlank(msg)) {
        switch(sle.getLevel()) {
            case SessionLog.SEVERE  : lg.error(msg); break;
            case SessionLog.WARNING : lg.warn (msg); break;
            case SessionLog.INFO    : lg.info (msg); break;
            case SessionLog.FINE    : lg.debug(msg); break;
            case SessionLog.FINER   : lg.trace(msg); break;
            case SessionLog.FINEST  : lg.trace(msg); break;
            case SessionLog.ALL     : lg.trace(msg); break;
            default                 : lg.debug(msg); break;
        }
    }
}
 
Example 3
Source File: EclipseLinkOSGiSessionLogger.java    From lb-karaf-examples-jpa with Apache License 2.0 6 votes vote down vote up
/**
 *
 */
@Override
public void log(SessionLogEntry sle) {
    Logger lg  = getLogger(sle);
    String msg = getMessage(sle);

    if(lg != null && StringUtils.isNotBlank(msg)) {
        switch(sle.getLevel()) {
            case SessionLog.SEVERE  : lg.error(msg); break;
            case SessionLog.WARNING : lg.warn (msg); break;
            case SessionLog.INFO    : lg.info (msg); break;
            case SessionLog.FINE    : lg.debug(msg); break;
            case SessionLog.FINER   : lg.trace(msg); break;
            case SessionLog.FINEST  : lg.trace(msg); break;
            case SessionLog.ALL     : lg.trace(msg); break;
            default                 : lg.debug(msg); break;
        }
    }
}
 
Example 4
Source File: JPAMTableCreator.java    From jeddict with Apache License 2.0 4 votes vote down vote up
/**
 * Drop the tables from the database.
 */
public void dropTables(DatabaseSession session, JPAMSchemaManager schemaManager, boolean build) {
    buildConstraints(schemaManager, build);

    // CR 3870467, do not log stack, or log at all if not fine
    boolean shouldLogExceptionStackTrace = session.getSessionLog().shouldLogExceptionStackTrace();
    int level = session.getSessionLog().getLevel();
    if (shouldLogExceptionStackTrace) {
        session.getSessionLog().setShouldLogExceptionStackTrace(false);
    }
    if (level > SessionLog.FINE) {
        session.getSessionLog().setLevel(SessionLog.SEVERE);
    }
    try {
        dropConstraints(session, schemaManager, false);

        String sequenceTableName = getSequenceTableName(session);
        List<JPAMTableDefinition> tables = getTableDefinitions();
        int trys = 1;
        if (JPAMSchemaManager.FORCE_DROP) {
            trys = 5;
        }
        while ((trys > 0) && !tables.isEmpty()) {
            trys--;
            List<JPAMTableDefinition> failed = new ArrayList<>();
            for (JPAMTableDefinition table : tables) {
                // Must not create sequence table as done in createSequences.
                if (!table.getName().equals(sequenceTableName)) {
                    try {
                        schemaManager.dropObject(table);
                    } catch (DatabaseException exception) {
                        failed.add(table);
                        if (!shouldIgnoreDatabaseException()) {
                            throw exception;
                        }
                    }
                }
            }
            tables = failed;
        }
    } finally {
        if (shouldLogExceptionStackTrace) {
            session.getSessionLog().setShouldLogExceptionStackTrace(true);
        }
        if (level > SessionLog.FINE) {
            session.getSessionLog().setLevel(level);
        }
    }
}