Search in sources :

Example 1 with BehaviorInvokePathResult

use of org.dbflute.bhv.logging.invoke.BehaviorInvokePathResult in project dbflute-core by dbflute.

the class BehaviorCommandInvoker method logInvocation.

// ===================================================================================
// Log Invocation
// ==============
protected <RESULT> void logInvocation(BehaviorCommand<RESULT> behaviorCommand, boolean saveOnly) {
    final StackTraceElement[] stackTrace = new Exception().getStackTrace();
    final BehaviorInvokeNameResult behaviorInvokeNameResult = extractBehaviorInvoke(behaviorCommand, stackTrace);
    saveBehaviorInvokeName(behaviorInvokeNameResult);
    final BehaviorInvokePathResult invokePathResult = buildInvokePath(behaviorCommand, stackTrace, behaviorInvokeNameResult);
    if (invokePathResult != null) {
        saveClientInvokeName(invokePathResult);
        saveByPassInvokeName(invokePathResult);
        saveInvokePath(invokePathResult);
    }
    if (saveOnly) {
        // e.g. log level is INFO and invocation path ready
        return;
    }
    final String expNoMethodSuffix = behaviorInvokeNameResult.getInvocationExpNoMethodSuffix();
    final String equalBorder = buildFitBorder("", "=", expNoMethodSuffix, false);
    final String frameBase = "/=====================================================";
    final String spaceBase = "                                                      ";
    log(frameBase + equalBorder + "==");
    log(spaceBase + behaviorInvokeNameResult.getInvocationExp());
    log(spaceBase + equalBorder + "=/");
    if (invokePathResult != null) {
        final String invokePath = invokePathResult.getInvokePath();
        if (Srl.is_NotNull_and_NotTrimmedEmpty(invokePath)) {
            // just in case
            log(invokePath);
        }
    }
    if (behaviorCommand.isOutsideSql() && !behaviorCommand.isProcedure()) {
        final OutsideSqlContext outsideSqlContext = getOutsideSqlContext();
        if (outsideSqlContext != null) {
            log("path: " + behaviorCommand.getOutsideSqlPath());
            log("option: " + behaviorCommand.getOutsideSqlOption());
        }
    }
}
Also used : OutsideSqlContext(org.dbflute.outsidesql.OutsideSqlContext) BehaviorInvokePathResult(org.dbflute.bhv.logging.invoke.BehaviorInvokePathResult) SQLException(java.sql.SQLException) SQLFailureException(org.dbflute.exception.SQLFailureException) BehaviorInvokeNameResult(org.dbflute.bhv.logging.invoke.BehaviorInvokeNameResult)

Aggregations

SQLException (java.sql.SQLException)1 BehaviorInvokeNameResult (org.dbflute.bhv.logging.invoke.BehaviorInvokeNameResult)1 BehaviorInvokePathResult (org.dbflute.bhv.logging.invoke.BehaviorInvokePathResult)1 SQLFailureException (org.dbflute.exception.SQLFailureException)1 OutsideSqlContext (org.dbflute.outsidesql.OutsideSqlContext)1