当前位置: 首页>>代码示例>>Java>>正文


Java InfoStatus类代码示例

本文整理汇总了Java中ch.qos.logback.core.status.InfoStatus的典型用法代码示例。如果您正苦于以下问题:Java InfoStatus类的具体用法?Java InfoStatus怎么用?Java InfoStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


InfoStatus类属于ch.qos.logback.core.status包,在下文中一共展示了InfoStatus类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configure

import ch.qos.logback.core.status.InfoStatus; //导入依赖的package包/类
public static void configure(KonkerLoggerContext lc) {
    StatusManager sm = lc.getStatusManager();
    if(sm != null) {
        sm.add(new InfoStatus("Setting up default configuration.", lc));
    }

    ConsoleAppender ca = new ConsoleAppender();
    ca.setContext(lc);
    ca.setName("console");
    PatternLayoutEncoder pl = new PatternLayoutEncoder();
    pl.setContext(lc);
    pl.setPattern("%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n");
    pl.start();
    ca.setEncoder(pl);
    ca.start();
    KonkerLogger rootLogger = lc.getLogger("ROOT");
    rootLogger.addAppender(ca);
}
 
开发者ID:KonkerLabs,项目名称:konker-platform,代码行数:19,代码来源:KonkerLoggerBasicConfigurator.java

示例2: secondPhase

import ch.qos.logback.core.status.InfoStatus; //导入依赖的package包/类
void secondPhase(String testId, String file, String stem, String compressionSuffix, int runLength, String prefix) {
  rfa1.stop();

  if (stem != null) {
    File f = new File(file);
    f.setLastModified(currentTime);
  }

  StatusManager sm = context.getStatusManager();
  sm.add(new InfoStatus("Time when rfa1 is stopped: " + new Date(currentTime), this));
  sm.add(new InfoStatus("currentTime%1000=" + (currentTime % 1000), this));

  initRollingFileAppender(rfa2, file);
  initPolicies(rfa2, tbrp2, randomOutputDir + testId + "-%d{"
          + DATE_PATTERN_WITH_SECONDS + "}-%i.txt" + compressionSuffix, sizeThreshold, currentTime, 0);

  for (int i = runLength; i < runLength * 2; i++) {
    incCurrentTime(100);
    tbrp2.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
    String msg = prefix + i;
    rfa2.doAppend(msg);
    addExpectedFileNamedIfItsTime(randomOutputDir, testId, msg, compressionSuffix);
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:25,代码来源:SizeAndTimeBasedFNATP_Test.java

示例3: configure

import ch.qos.logback.core.status.InfoStatus; //导入依赖的package包/类
public static void configure(LoggerContext lc) {
  StatusManager sm = lc.getStatusManager();
  if(sm != null)  {
   sm.add(new InfoStatus("Setting up default configuration.", lc));
  }
  ConsoleAppender<ILoggingEvent> ca = new ConsoleAppender<ILoggingEvent>();
  ca.setContext(lc);
  ca.setName("console");
  PatternLayoutEncoder pl = new PatternLayoutEncoder();
  pl.setContext(lc);
  pl.setPattern("%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n");
  pl.start();

  ca.setEncoder(pl);
  ca.start();
  Logger rootLogger = lc.getLogger(Logger.ROOT_LOGGER_NAME);
  rootLogger.addAppender(ca);
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:19,代码来源:BasicConfigurator.java

示例4: findConfigFileURL

import ch.qos.logback.core.status.InfoStatus; //导入依赖的package包/类
private URL findConfigFileURL(Context ctx, LoggerContext loggerContext) {
  StatusManager sm = loggerContext.getStatusManager();

  String jndiEntryForConfigResource = JNDIUtil.lookup(ctx,
          JNDI_CONFIGURATION_RESOURCE);
  // Do we have a dedicated configuration file?
  if (jndiEntryForConfigResource != null) {
    sm.add(new InfoStatus("Searching for [" + jndiEntryForConfigResource
            + "]", this));
    URL url = urlByResourceName(sm, jndiEntryForConfigResource);
    if (url == null) {
      String msg = "The jndi resource [" + jndiEntryForConfigResource
              + "] for context [" + loggerContext.getName()
              + "] does not lead to a valid file";
      sm.add(new WarnStatus(msg, this));
    }
    return url;
  } else {
    String resourceByConvention = conventionalConfigFileName(loggerContext
            .getName());
    return urlByResourceName(sm, resourceByConvention);
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:24,代码来源:ContextJNDISelector.java

示例5: configure

import ch.qos.logback.core.status.InfoStatus; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void configure(LoggerContext loggerContext) {
    StatusManager sm = loggerContext.getStatusManager();
    if (sm != null) {
        sm.add(new InfoStatus("Setting up GreenPepper PHP Runner configuration.", loggerContext));
    }
    ConsoleAppender<ILoggingEvent> ca = new ConsoleAppender<ILoggingEvent>();
    ca.setContext(loggerContext);
    ca.setName("console");
    PatternLayoutEncoder pl = new PatternLayoutEncoder();
    pl.setContext(loggerContext);
    pl.setPattern("%d{yyyy-MM-dd HH:mm:ss.SSS}  %-5level   %-36logger{36} - %msg%n");
    pl.start();

    ca.setEncoder(pl);
    ca.start();
    Logger rootLogger = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
    rootLogger.addAppender(ca);
    rootLogger.setLevel(Level.INFO);
}
 
开发者ID:strator-dev,项目名称:greenpepper,代码行数:22,代码来源:DefaultLogbackConfigurator.java

示例6: configure

import ch.qos.logback.core.status.InfoStatus; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void configure(LoggerContext loggerContext) {
    StatusManager sm = loggerContext.getStatusManager();
    if (sm != null) {
        sm.add(new InfoStatus("Setting up default configuration.", loggerContext));
    }
    ConsoleAppender<ILoggingEvent> ca = new ConsoleAppender<ILoggingEvent>();
    ca.setContext(loggerContext);
    ca.setName("console");
    PatternLayoutEncoder pl = new PatternLayoutEncoder();
    pl.setContext(loggerContext);
    pl.setPattern("[%-5level] %msg%n");
    pl.start();

    ca.setEncoder(pl);
    ca.start();
    Logger rootLogger = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
    rootLogger.addAppender(ca);
    rootLogger.setLevel(Level.WARN);
    loggerContext.getLogger("com.greenpepper.maven.plugin").setLevel(Level.INFO);
}
 
开发者ID:strator-dev,项目名称:greenpepper,代码行数:23,代码来源:DefaultLogbackConfigurator.java

示例7: flush

import ch.qos.logback.core.status.InfoStatus; //导入依赖的package包/类
public void flush(AppenderType appenderType, Appender<ILoggingEvent> appender) {
    this.lock.lock();

    try {
        this.appender = appender;

        int numCachedEvents = this.cache.size();

        while (!this.cache.isEmpty()) {
            this.doAppend(this.cache.removeFirst());
        }

        this.context.getStatusManager().add(new InfoStatus(String.format("Flushed %d cached application (name=%s) logging event(s) to appender (type=%s).",
            numCachedEvents, this.app.getName(), appenderType.getId()), appender));
    } finally {
        this.lock.unlock();
    }
}
 
开发者ID:esacinc,项目名称:sdcct,代码行数:19,代码来源:CachingAppender.java

示例8: initLogback

import ch.qos.logback.core.status.InfoStatus; //导入依赖的package包/类
public static void initLogback() {
    LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();

    StatusManager statusManager = loggerContext.getStatusManager();
    if (statusManager != null) {
        statusManager.add(new InfoStatus("Setting up logger configuration.", loggerContext));
    }

    final PatternLayout layout = new PatternLayout();
    layout.setContext(loggerContext);
    layout.setPattern("%msg%n");
    layout.start();

    AppenderBase<ILoggingEvent> appender = new AppenderBase<ILoggingEvent>() {
        @Override
        protected void append(ILoggingEvent event) {
            String message = layout.doLayout(event);
            LogHelper.appendLogEntry(event.getTimeStamp(), convertLevel(event.getLevel()),
                    event.getLoggerName(), event.getThreadName(), message);
        }
    };
    appender.setContext(loggerContext);
    appender.setName(LOGBACK_APPENDER_NAME);
    appender.start();

    Logger rootLogger = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
    rootLogger.addAppender(appender);
}
 
开发者ID:noveogroup,项目名称:clap,代码行数:29,代码来源:LogbackHelper.java

示例9: configure

import ch.qos.logback.core.status.InfoStatus; //导入依赖的package包/类
public static void configure(LoggerContext loggerContext) {
    loggerContext.reset();

    StatusManager sm = loggerContext.getStatusManager();
    if (sm != null) {
        sm.add(new InfoStatus("Setting up default Pipes configuration.", loggerContext));
    }

    ConsoleAppender<ILoggingEvent> ca = new ConsoleAppender<>();
    ca.setContext(loggerContext);
    ca.setWithJansi(true);
    ca.setName("console");

    PatternLayoutEncoder pl = new PatternLayoutEncoder();
    pl.setCharset(Charset.forName("UTF-8"));
    pl.setContext(loggerContext);
    //pl.setPattern("%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n");
    pl.setPattern("%msg%n");
    pl.start();

    ca.setEncoder(pl);
    ca.start();
    ch.qos.logback.classic.Logger rootLogger = loggerContext.getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME);
    rootLogger.setLevel(Level.INFO);
    rootLogger.addAppender(ca);
}
 
开发者ID:wmluke,项目名称:pipes,代码行数:27,代码来源:LogbackConfig.java

示例10: start

import ch.qos.logback.core.status.InfoStatus; //导入依赖的package包/类
@Override
public void start() throws LifecycleException {
    super.start();
    ctx.start();
    if (filename == null) {
        filename = OptionHelper.getSystemProperty("logbackAccess.configurationFile");
        if (filename == null) {
            filename = DEFAULT_CONFIG_FILE;
        }
        ctx.getStatusManager().add(new InfoStatus("filename property not set. Assuming [" + filename + "]", this));
    }
    // TODO: Support classpath config
    File configFile = new File(filename);
    if (configFile.exists()) {
        try {
            JoranConfigurator jc = new JoranConfigurator();
            jc.setContext(ctx);
            jc.doConfigure(filename);
        } catch (JoranException e) {
            // TODO can we do better than printing a stack trace on syserr?
            e.printStackTrace();
        }
    } else {
        ctx.getStatusManager().add(new WarnStatus("[" + filename + "] does not exist", this));
    }

    if (!quiet) {
        StatusPrinter.print(ctx.getStatusManager());
    }
    
}
 
开发者ID:goodees,项目名称:goodees,代码行数:32,代码来源:CatalinaValve.java

示例11: createLogGroup

import ch.qos.logback.core.status.InfoStatus; //导入依赖的package包/类
private void createLogGroup() {
    try {
        awsLogs.createLogGroup(new CreateLogGroupRequest().withLogGroupName(logGroupName));
    } catch (final ResourceAlreadyExistsException e) {
        addStatus(new InfoStatus(e.getMessage(), this));
    }
}
 
开发者ID:minijax,项目名称:minijax,代码行数:8,代码来源:CloudWatchAppender.java

示例12: createLogStream

import ch.qos.logback.core.status.InfoStatus; //导入依赖的package包/类
private void createLogStream() {
    try {
        awsLogs.createLogStream(new CreateLogStreamRequest().withLogGroupName(logGroupName).withLogStreamName(logStreamName));
    } catch (final ResourceAlreadyExistsException e) {
        addStatus(new InfoStatus(e.getMessage(), this));
    }
}
 
开发者ID:minijax,项目名称:minijax,代码行数:8,代码来源:CloudWatchAppender.java

示例13: heartbeatStart

import ch.qos.logback.core.status.InfoStatus; //导入依赖的package包/类
/**
     * 心跳检测开始
     */
    public void heartbeatStart() {
        // 心跳检测定时器初始化
        this.timer = new Timer();
        this.timer.schedule(new TimerTask() {
            @Override
            public void run() {
                byte[] key = ByteBuffer.allocate(4).putInt(Constants.HEARTBEAT_KEY.hashCode()).array();
                final ProducerRecord<byte[], String> record = new ProducerRecord<>(topic, key, Constants.HEARTBEAT_VALUE);

                // java 8 lambda
//                LazySingletonProducer.getInstance(config).send(record, (RecordMetadata recordMetadata, Exception e) -> {
                // logic code
//                });

                LazySingletonProducer.getInstance(config).send(record, new Callback() {
                    @Override
                    public void onCompletion(RecordMetadata recordMetadata, Exception e) {
                        if (null == e) {
                            // 更新flag状态
                            flag.compareAndSet(false, true);
                            // 如果没有发生异常, 说明kafka从异常状态切换为正常状态, 将开始状态设置为true
                            started = true;
                            addStatus(new InfoStatus("kafka send normal in appender", this, e));
                            // 关闭心跳检测机制
                            KafkaAppender.this.heartbeatStop();
                            zkRegister.write(Constants.SLASH + app + Constants.SLASH + host, NodeMode.EPHEMERAL,
                                    String.valueOf(Constants.APP_APPENDER_RESTART_KEY + Constants.SEMICOLON + System.currentTimeMillis()) + Constants.SEMICOLON + SysUtil.userDir);
                        }
                    }
                });
            }
        }, 10000,60000);
    }
 
开发者ID:JThink,项目名称:SkyEye,代码行数:37,代码来源:KafkaAppender.java

示例14: statusOnResourceSearch

import ch.qos.logback.core.status.InfoStatus; //导入依赖的package包/类
private void statusOnResourceSearch(String resourceName, ClassLoader classLoader, URL url) {
    StatusManager sm = this.loggerContext.getStatusManager();
    if (url == null) {
        sm.add(new InfoStatus("Could NOT find resource [" + resourceName + "]", this.loggerContext));
    } else {
        sm.add(new InfoStatus("Found resource [" + resourceName + "] at [" + url.toString() + "]", this.loggerContext));
        this.multiplicityWarning(resourceName, classLoader);
    }

}
 
开发者ID:KonkerLabs,项目名称:konker-platform,代码行数:11,代码来源:KonkerContextInitializer.java

示例15: postSuccessfulWrite

import ch.qos.logback.core.status.InfoStatus; //导入依赖的package包/类
private void postSuccessfulWrite() {
  if (recoveryCoordinator != null) {
    recoveryCoordinator = null;
    statusCount = 0;
    addStatus(new InfoStatus("Recovered from IO failure on "
        + getDescription(), this));
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:9,代码来源:ResilientOutputStreamBase.java


注:本文中的ch.qos.logback.core.status.InfoStatus类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。