Search in sources :

Example 1 with AppServerLogPublishWorker

use of com.creditease.agent.feature.logagent.AppServerLogPublishWorker in project uavstack by uavorg.

the class LogAgent method start.

@Override
public void start() {
    /**
     * start LogCatchScheduleWorker
     *
     * timing to run logCatcher
     */
    this.getConfigManager().registerComponent(this.feature, "LogDataLog", super.log);
    LogCatchScheduleWorker catcher = new LogCatchScheduleWorker("LogCatchScheduleWorker", this.feature);
    String interval = this.getConfigManager().getFeatureConfiguration(this.feature, "interval");
    this.getTimerWorkManager().scheduleWork("LogCatchScheduleWorker", catcher, 0, DataConvertHelper.toLong(interval, 3000));
    if (log.isTraceEnable()) {
        log.info(this, "ApplicationServer LogCatchScheduleWorker started");
    }
    TailLogContext.getInstance().put("selfLog.enable", this.getConfigManager().getFeatureConfiguration(this.feature, "selfLog.enable"));
    /**
     * start AppServerLogPublishWorker
     *
     * when logCatcher processes data done, AppServerLogPublishWorker publishes logData
     */
    log.info(this, "LogAgent LogDataFrame.enable: " + this.getConfigManager().getFeatureConfiguration(this.feature, "LogDataFrame.enable"));
    TailLogContext.getInstance().put("LogDataFrame.enable", this.getConfigManager().getFeatureConfiguration(this.feature, "LogDataFrame.enable"));
    if (TailLogContext.getInstance().getBoolean("LogDataFrame.enable")) {
        AppServerLogPublishWorkerByStream aplcbs = new AppServerLogPublishWorkerByStream("AppServerLogPublishWorker", this.feature);
        logCatchWorkerThread = new Thread(aplcbs);
    } else {
        AppServerLogPublishWorker aplc = new AppServerLogPublishWorker("AppServerLogPublishWorker", this.feature);
        logCatchWorkerThread = new Thread(aplc);
    }
    logCatchWorkerThread.start();
    if (log.isTraceEnable()) {
        log.info(this, "ApplicationServer LogPublishWorker started");
    }
    /**
     * TailFileProcess will process existingInodes in Muti-Thread Model
     */
    log.info(this, "LogAgent Muti Thread enabled:" + this.getConfigManager().getFeatureConfiguration(this.feature, "MutiThread.enable"));
    TailLogContext.getInstance().put("MutiThread.enable", this.getConfigManager().getFeatureConfiguration(this.feature, "MutiThread.enable"));
    TailLogContext.getInstance().put("MutiThread.thread.max", this.getConfigManager().getFeatureConfiguration(this.feature, "MutiThread.thread.max"));
    if (TailLogContext.getInstance().getBoolean("MutiThread.enable")) {
        executor = this.getForkjoinWorkerMgr().newForkjoinWorker("TailLogProcessPoolWorker", this.feature, TailLogContext.getInstance().getInteger("MutiThread.thread.max"));
    }
    /**
     * regist node ctrl action
     */
    IActionEngine engine = this.getActionEngineMgr().getActionEngine("NodeOperActionEngine");
    new LogNodeOperAction("logstragety", feature, engine);
    loadLogCfg();
}
Also used : AppServerLogPublishWorkerByStream(com.creditease.agent.feature.logagent.AppServerLogPublishWorkerByStream) LogNodeOperAction(com.creditease.agent.feature.logagent.actions.LogNodeOperAction) AppServerLogPublishWorker(com.creditease.agent.feature.logagent.AppServerLogPublishWorker) IActionEngine(com.creditease.agent.spi.IActionEngine)

Aggregations

AppServerLogPublishWorker (com.creditease.agent.feature.logagent.AppServerLogPublishWorker)1 AppServerLogPublishWorkerByStream (com.creditease.agent.feature.logagent.AppServerLogPublishWorkerByStream)1 LogNodeOperAction (com.creditease.agent.feature.logagent.actions.LogNodeOperAction)1 IActionEngine (com.creditease.agent.spi.IActionEngine)1