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


Java StatusPrinter.print方法代码示例

本文整理汇总了Java中ch.qos.logback.core.util.StatusPrinter.print方法的典型用法代码示例。如果您正苦于以下问题:Java StatusPrinter.print方法的具体用法?Java StatusPrinter.print怎么用?Java StatusPrinter.print使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ch.qos.logback.core.util.StatusPrinter的用法示例。


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

示例1: checkSanity

import ch.qos.logback.core.util.StatusPrinter; //导入方法依赖的package包/类
static void checkSanity(Auditor auditor) throws AuditException {
    StatusManager sm = auditor.getStatusManager();

    if (getHighestLevel(0, sm) > Status.INFO) {
        StatusPrinter.print(sm);
    }

    if (auditor.getClientApplication() == null) {
        throw new AuditException("Client application has not been set");
    }

    if (auditor.getAuditAppender() == null) {
        throw new AuditException("No audit appender. Please see "
                + NULL_AUDIT_APPENDER_URL);
    }
}
 
开发者ID:bhits,项目名称:common-libraries,代码行数:17,代码来源:ImprovedAuditorFactory.java

示例2: main

import ch.qos.logback.core.util.StatusPrinter; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
  Context context = new ContextBase();

  Map<ElementSelector, Action> ruleMap = new HashMap<ElementSelector, Action>();

  // Associate "/computation" pattern with ComputationAction1
  ruleMap.put(new ElementSelector("/computation"), new ComputationAction1());

  // Other associations
  ruleMap.put(new ElementSelector("/computation/literal"), new LiteralAction());
  ruleMap.put(new ElementSelector("/computation/add"), new AddAction());
  ruleMap.put(new ElementSelector("/computation/multiply"), new MultiplyAction());

  SimpleConfigurator simpleConfigurator = new SimpleConfigurator(ruleMap);
  // link the configurator with its context
  simpleConfigurator.setContext(context);

  simpleConfigurator.doConfigure(args[0]);
  // Print any errors that might have occured.
  StatusPrinter.print(context);
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:22,代码来源:Calculator1.java

示例3: IOPerformance

import ch.qos.logback.core.util.StatusPrinter; //导入方法依赖的package包/类
public IOPerformance(boolean _immediateFlush, long _len) {
  this.len = _len;
  this.immediateFlush = _immediateFlush;
  context = new LoggerContext();
  logger = context.getLogger("logger-" + getName());

  // A FileAppender is created according to the buffering and
  // immediate flush setting of this IO instance.
  FileAppender<ILoggingEvent> fa = new FileAppender<ILoggingEvent>();
  fa.setName("FILE");
  PatternLayoutEncoder pa = new PatternLayoutEncoder();
  pa.setPattern("%r %5p %c [%t] - %m%n");
  pa.setContext(context);
  pa.start();
  fa.setEncoder(pa);

  fa.setFile(LOG_FILE);
  fa.setAppend(true);
  fa.setContext(context);
  fa.start();

  ((ch.qos.logback.classic.Logger) logger).addAppender(fa);

  StatusPrinter.print(context);
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:26,代码来源:IOPerformance.java

示例4: init

import ch.qos.logback.core.util.StatusPrinter; //导入方法依赖的package包/类
static void init(String portStr, String configFile) throws JoranException {
  try {
    port = Integer.parseInt(portStr);
  } catch (java.lang.NumberFormatException e) {
    e.printStackTrace();
    usage("Could not interpret port number [" + portStr + "].");
  }

  basicContext = new AccessContext();
  if (configFile.endsWith(".xml")) {
    JoranConfigurator configurator = new JoranConfigurator();
    configurator.setContext(basicContext);
    configurator.doConfigure(configFile);
    StatusPrinter.print(basicContext);
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:17,代码来源:SimpleSocketServer.java

示例5: main

import ch.qos.logback.core.util.StatusPrinter; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
  Map<ElementSelector, Action> ruleMap = new HashMap<ElementSelector, Action>();
 
  
  // Note the wild card character '*', in the paterns, signifying any level 
  // of nesting.
  ruleMap.put(new ElementSelector("*/computation"), new ComputationAction2());

  ruleMap.put(new ElementSelector("*/computation/literal"), new LiteralAction());
  ruleMap.put(new ElementSelector("*/computation/add"), new AddAction());
  ruleMap.put(new ElementSelector("*/computation/multiply"), new MultiplyAction());
  
  Context context = new ContextBase();
  SimpleConfigurator simpleConfigurator = new SimpleConfigurator(ruleMap);
  // link the configurator with its context
  simpleConfigurator.setContext(context);

  try {
    simpleConfigurator.doConfigure(args[0]);
  } catch (JoranException e) {
    // Print any errors that might have occured.
    StatusPrinter.print(context);
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:25,代码来源:Calculator2.java

示例6: testCheckNoHeadersAreInserted

import ch.qos.logback.core.util.StatusPrinter; //导入方法依赖的package包/类
@Test
public void testCheckNoHeadersAreInserted() throws Exception {
  setInsertHeadersAndStart(false);

  IAccessEvent event = createAccessEvent();
  appender.append(event);
  StatusPrinter.print(context.getStatusManager());

  //Check that no headers were inserted
  Statement stmt = connectionSource.getConnection().createStatement();
  ResultSet rs = null;
  rs = stmt.executeQuery("SELECT * FROM access_event_header where EVENT_ID = " + existingEventTableRowCount);

  assertFalse(rs.next());
  rs.close();
  stmt.close();
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:18,代码来源:DBAppenderHSQLTest.java

示例7: authenticatedGmail_SSL

import ch.qos.logback.core.util.StatusPrinter; //导入方法依赖的package包/类
@Test
@Ignore
public void authenticatedGmail_SSL() throws Exception {
  smtpAppender.setSMTPHost("smtp.gmail.com");
  smtpAppender.setSMTPPort(465);

  smtpAppender.addTo("[email protected]");
  smtpAppender.setSSL(true);
  smtpAppender.setUsername("[email protected]");
  smtpAppender.setPassword("XXX");

  smtpAppender.setLayout(buildPatternLayout(loggerContext));
  smtpAppender.start();
  Logger logger = loggerContext.getLogger("authenticatedGmail_SSL");
  logger.addAppender(smtpAppender);
  logger.debug("hello");
  logger.error("en error", new Exception("an exception"));

  StatusPrinter.print(loggerContext);
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:21,代码来源:SMTPAppender_SubethaSMTPTest.java

示例8: authenticatedGmailStartTLS

import ch.qos.logback.core.util.StatusPrinter; //导入方法依赖的package包/类
@Test
@Ignore
public void authenticatedGmailStartTLS() throws Exception {
  smtpAppender.setSMTPHost("smtp.gmail.com");
  smtpAppender.setSMTPPort(587);

  smtpAppender.addTo("[email protected]");
  smtpAppender.setSTARTTLS(true);
  smtpAppender.setUsername("[email protected]");
  smtpAppender.setPassword("XXX");

  smtpAppender.setLayout(buildPatternLayout(loggerContext));
  smtpAppender.start();
  Logger logger = loggerContext.getLogger("authenticatedGmailSTARTTLS");
  logger.addAppender(smtpAppender);
  logger.debug("hello");
  logger.error("en error", new Exception("an exception"));

  StatusPrinter.print(loggerContext);
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:21,代码来源:SMTPAppender_SubethaSMTPTest.java

示例9: main

import ch.qos.logback.core.util.StatusPrinter; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException {
  Logger logger = (Logger) LoggerFactory.getLogger(ConfigurationTester.class);
  LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();

  try {
    JoranConfigurator configurator = new JoranConfigurator();
    configurator.setContext(lc);
    lc.reset();
    configurator.doConfigure(args[0]);
  } catch (JoranException je) {
    je.printStackTrace();
  }
  // After we've called Joran, let's print information about the
  // internal status of logback
  StatusPrinter.print(lc);

  logger.debug("**Hello {}", new Bar());
  MDC.put("testKey", "testValueFromMDC");
  MDC.put("testKey2", "value2");
  for (int i = 0; i < 10; i++) {
    logger.debug("logging statement " + i);
    Thread.sleep(100);
  }
  Bar bar = new Bar();
  bar.createLoggingRequest();
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:27,代码来源:ConfigurationTester.java

示例10: start

import ch.qos.logback.core.util.StatusPrinter; //导入方法依赖的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: debugLoggingConfiguration

import ch.qos.logback.core.util.StatusPrinter; //导入方法依赖的package包/类
public void debugLoggingConfiguration() {
        // For debugging problems with the logback configuration
        LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
        // print logback's internal status
        StatusPrinter.print(lc);
//        Logger logger = LoggerFactory.getLogger(Logging.class);
    }
 
开发者ID:scifiswapnil,项目名称:gadgetbridge_artikcloud,代码行数:8,代码来源:Logging.java

示例12: testConversionRuleSupportInHtmlLayout

import ch.qos.logback.core.util.StatusPrinter; //导入方法依赖的package包/类
@Test
public void testConversionRuleSupportInHtmlLayout() throws JoranException {
  configure(ClassicTestConstants.JORAN_INPUT_PREFIX
      + "conversionRule/htmlLayout0.xml");
 
  root.getAppender("LIST");
  String msg = "Simon says";
  root.debug(msg);
  StringListAppender<ILoggingEvent> sla = (StringListAppender<ILoggingEvent>) root
      .getAppender("LIST");
  assertNotNull(sla);
  StatusPrinter.print(lc);
  assertEquals(1, sla.strList.size());
  assertFalse(sla.strList.get(0).contains("PARSER_ERROR"));
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:16,代码来源:HTMLLayoutTest.java

示例13: start

import ch.qos.logback.core.util.StatusPrinter; //导入方法依赖的package包/类
@Override
public void start() {
  configure();
  if (!isQuiet()) {
    StatusPrinter.print(getStatusManager());
  }
  started = true;
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:9,代码来源:RequestLogImpl.java

示例14: main

import ch.qos.logback.core.util.StatusPrinter; //导入方法依赖的package包/类
public static void main(String[] args) {
  // assume SLF4J is bound to logback in the current environment
  LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
  // print logback's internal status
  StatusPrinter.print(lc);
  
  logger.info("Entering application.");
  Foo foo = new Foo();
  foo.doIt();
  logger.info("Exiting application.");
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:12,代码来源:MyApp2.java

示例15: MANUAL_renamingOnDifferentVolumesOnLinux

import ch.qos.logback.core.util.StatusPrinter; //导入方法依赖的package包/类
@Test
@Ignore
public void MANUAL_renamingOnDifferentVolumesOnLinux() throws IOException, RolloverFailure {
  RenameUtil renameUtil = new RenameUtil();
  renameUtil.setContext(context);

  String src = "/tmp/ramdisk/foo.txt";
  FileOutputStream fis = new FileOutputStream(src);
  fis.write(("hello" + diff).getBytes());

  renameUtil.rename(src, "/tmp/foo" + diff + ".txt");
  StatusPrinter.print(context);
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:14,代码来源:RenameUtilTest.java


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