Search in sources :

Example 1 with BehaviorInvokeNameResult

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

the class BehaviorCommandInvoker method saveInvokePath.

protected void saveInvokePath(BehaviorInvokePathResult invokePathResult) {
    final BehaviorInvokeNameResult behaviorInvokeNameResult = invokePathResult.getBehaviorInvokeNameResult();
    final String invokePath = invokePathResult.getInvokePath();
    final String callerExp = behaviorInvokeNameResult.getInvocationExp();
    final String omitMark = BehaviorInvokePathBuilder.OMIT_MARK;
    InternalMapContext.setSavedInvokePath(Srl.substringLastFront(invokePath, omitMark) + callerExp);
}
Also used : BehaviorInvokeNameResult(org.dbflute.bhv.logging.invoke.BehaviorInvokeNameResult)

Example 2 with BehaviorInvokeNameResult

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

the class BehaviorCommandInvoker method createUnknownInvokeNameResult.

protected BehaviorInvokeNameResult createUnknownInvokeNameResult() {
    // basically no way
    final String unknownKeyword;
    if (OutsideSqlContext.isExistOutsideSqlContextOnThread()) {
        // e.g. OutsideSql engine use
        final OutsideSqlContext context = OutsideSqlContext.getOutsideSqlContextOnThread();
        unknownKeyword = context.getTableDbName();
    } else {
        unknownKeyword = "Unknown";
    }
    final String expNoMethodSuffix = unknownKeyword + ".invoke";
    return new BehaviorInvokeNameResult(expNoMethodSuffix + "()", expNoMethodSuffix, null, null);
}
Also used : OutsideSqlContext(org.dbflute.outsidesql.OutsideSqlContext) BehaviorInvokeNameResult(org.dbflute.bhv.logging.invoke.BehaviorInvokeNameResult)

Example 3 with BehaviorInvokeNameResult

use of org.dbflute.bhv.logging.invoke.BehaviorInvokeNameResult 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

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