Search in sources :

Example 11 with ActionLog

use of core.framework.impl.log.ActionLog in project core-ng-project by neowu.

the class WebServiceClient method linkContext.

private void linkContext(HTTPRequest httpRequest) {
    ActionLog actionLog = logManager.currentActionLog();
    // web service client may be used without action log context
    if (actionLog == null)
        return;
    httpRequest.header(HTTPServerHandler.HEADER_REF_ID.toString(), actionLog.refId());
    if (actionLog.trace) {
        httpRequest.header(HTTPServerHandler.HEADER_TRACE.toString(), "true");
    }
}
Also used : ActionLog(core.framework.impl.log.ActionLog)

Example 12 with ActionLog

use of core.framework.impl.log.ActionLog in project core-ng-project by neowu.

the class Scheduler method submitJob.

void submitJob(Trigger trigger, boolean trace) {
    jobExecutor.submit(() -> {
        try {
            ActionLog actionLog = logManager.begin("=== job execution begin ===");
            String name = trigger.name();
            actionLog.action("job:" + name);
            if (trace) {
                actionLog.trace = true;
            }
            Job job = trigger.job();
            actionLog.context("job", name);
            actionLog.context("jobClass", job.getClass().getCanonicalName());
            job.execute();
            return null;
        } catch (Throwable e) {
            logManager.logError(e);
            throw e;
        } finally {
            logManager.end("=== job execution end ===");
        }
    });
}
Also used : Job(core.framework.scheduler.Job) ActionLog(core.framework.impl.log.ActionLog)

Aggregations

ActionLog (core.framework.impl.log.ActionLog)12 LogManager (core.framework.impl.log.LogManager)5 BytesParam (core.framework.impl.log.filter.BytesParam)1 RequestImpl (core.framework.impl.web.request.RequestImpl)1 Message (core.framework.kafka.Message)1 Job (core.framework.scheduler.Job)1 Response (core.framework.web.Response)1 HeaderMap (io.undertow.util.HeaderMap)1 HttpString (io.undertow.util.HttpString)1 ArrayList (java.util.ArrayList)1 Headers (org.apache.kafka.common.header.Headers)1