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


Java Level类代码示例

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


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

示例1: Bitcoin

import ch.qos.logback.classic.Level; //导入依赖的package包/类
private Bitcoin() {
    BriefLogFormatter.initWithSilentBitcoinJ();
    ch.qos.logback.classic.Logger rootLogger = (ch.qos.logback.classic.Logger)LoggerFactory.getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME);
    rootLogger.setLevel(Level.toLevel("info"));

    // Context.enableStrictMode();
    final NetworkParameters params = TestNet3Params.get();
    context = new Context(params);
    Context.propagate(context);

    // read system property to check if broken wallet shall be recovered from backup automatically
    automaticallyRecoverBrokenWallet = System.getProperty("automaticallyRecoverBrokenWallet").equalsIgnoreCase("true");

    // prepare (unused) random seed to save time when constructing coupon wallets for invoices
    byte[] seed = new byte[DeterministicSeed.DEFAULT_SEED_ENTROPY_BITS/8];
    List<String> mnemonic = new ArrayList<>(0);
    couponRandomSeed = new DeterministicSeed(seed, mnemonic, MnemonicCode.BIP39_STANDARDISATION_TIME_SECS);
}
 
开发者ID:IUNO-TDM,项目名称:PaymentService,代码行数:19,代码来源:Bitcoin.java

示例2: changeLevel

import ch.qos.logback.classic.Level; //导入依赖的package包/类
@PutMapping("/logs")
@ResponseStatus(HttpStatus.NO_CONTENT)
@Timed
public void changeLevel(@RequestBody LoggerVM jsonLogger) {
    LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
    context.getLogger(jsonLogger.getName()).setLevel(Level.valueOf(jsonLogger.getLevel()));
}
 
开发者ID:oktadeveloper,项目名称:jhipster-microservices-example,代码行数:8,代码来源:LogsResource.java

示例3: setUp

import ch.qos.logback.classic.Level; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
  registry = RegistryService.getMetricRegistry();

  TagEncodedMetricName rootName = APPENDS_BASE_NAME;
  TagEncodedMetricName throwablesBaseName = THROWABLES_BASE_NAME;

  meters = new HashMap<>();
  meters.put("total", getMeter(rootName.submetric("total")));
  meters.put("trace", getMeter(rootName.withTags("level", "trace")));
  meters.put("debug", getMeter(rootName.withTags("level", "debug")));
  meters.put("info", getMeter(rootName.withTags("level", "info")));
  meters.put("warn", getMeter(rootName.withTags("level", "warn")));
  meters.put("error", getMeter(rootName.withTags("level", "error")));
  meters.put("throwCount", getMeter(throwablesBaseName.submetric("total")));
  meters.put("throw[RuntimeException]",
      getMeter(throwablesBaseName.withTags("class", RuntimeException.class.getName())
      ));

  LoggerContext context = new LoggerContext();

  logger = context.getLogger(LogbackInstrumentationTest.class);
  origLevel = logger.getLevel();
  logger.setLevel(Level.ALL);
}
 
开发者ID:ApptuitAI,项目名称:JInsight,代码行数:26,代码来源:LogbackInstrumentationTest.java

示例4: append

import ch.qos.logback.classic.Level; //导入依赖的package包/类
/**
 * The logging system calls append for every log message. This method
 * filters out the WARN and ERROR message and adds to a debug event queue
 * that can be accessed via cli or rest-api or gui.
 */
@Override
protected void append(E eventObject) {
    if (!isStarted()) {
        return;
    }
    if (evWarnError != null) {
        ILoggingEvent ev = ((ILoggingEvent) eventObject);
        if (ev.getLevel().equals(Level.ERROR)
            || ev.getLevel().equals(Level.WARN)) {
            evWarnError
            .newEventWithFlush(new WarnErrorEvent(ev.getFormattedMessage(),
                                                  ev.getLevel(),
                                                  ev.getThreadName(),
                                                  ev.getLoggerName()));
        }
    }
}
 
开发者ID:nsg-ethz,项目名称:iTAP-controller,代码行数:23,代码来源:DebugEventAppender.java

示例5: run

import ch.qos.logback.classic.Level; //导入依赖的package包/类
public void run() {
    if (debug) {
        org.slf4j.Logger rootLogger = LoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
        Logger logbackRootLogger = (Logger) rootLogger;
        logbackRootLogger.setLevel(Level.TRACE);
    }
    try {
        doRun();
    } catch (Exception e) {
        if (debug) {
            LoggerFactory.getLogger(this.getClass()).error("Error while running", e);
        } else {
            System.err.println(String.format(Locale.ROOT, "Error occured: %s", e.getMessage()));
        }
    }

    if (debug) {
        try {
            bos.flush();
            System.err.write(bos.toByteArray());
        } catch (IOException exc) {
            exc.printStackTrace();
        }
    }
}
 
开发者ID:spinscale,项目名称:maxcube-java,代码行数:26,代码来源:Cli.java

示例6: doWithLoggingBlocked

import ch.qos.logback.classic.Level; //导入依赖的package包/类
protected <T> T doWithLoggingBlocked(String log4jLoggerStr, Log4jBlockingCallback<T> cb) throws Exception {

        ch.qos.logback.classic.Logger logger = null;
        Level loggerLevel = null;
        ch.qos.logback.classic.Logger root = null;
        Level rootLevel = null;
        try {
            logger = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(log4jLoggerStr);
            loggerLevel = disableLogger(logger);

            final T t = cb.execute();
            return t;
        } finally {
            enableLogger(logger, loggerLevel);
            enableLogger(root, rootLevel);
        }
    }
 
开发者ID:shared-vd,项目名称:tipi-engine,代码行数:18,代码来源:AbstractSpringBootTruncaterTest.java

示例7: fieldsConfigTest

import ch.qos.logback.classic.Level; //导入依赖的package包/类
@Test
public void fieldsConfigTest()
{
    LogFmtLayout logFmtLayout = new LogFmtLayout();
    logFmtLayout.setFields("time, mdc, custom, level, msg");
    logFmtLayout.setTimeFormat("YYYY");

    Calendar calendar = Calendar.getInstance();
    calendar.set(2017, Calendar.NOVEMBER, 30, 15, 10, 25);

    Map<String, String> mdc = new HashMap<>();
    mdc.put("mdckey", "mdc value");

    ILoggingEvent loggingEvent = createLoggingEvent("thread0", Level.DEBUG, calendar.getTime(),
        with("key1", "value1").and("key2", "val ue2"), "message with \"double quotes\"", mdc);

    assertEquals(
        "time=2017 mdckey=\"mdc value\" key1=value1 key2=\"val ue2\" level=debug msg=\"message with \\\"double quotes\\\"\"\n",
        logFmtLayout.doLayout(loggingEvent)
    );
}
 
开发者ID:BatchLabs,项目名称:escalog,代码行数:22,代码来源:LogFmtLayoutTest.java

示例8: disableAllOntopLogger

import ch.qos.logback.classic.Level; //导入依赖的package包/类
public void disableAllOntopLogger(){
	
	((ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(QuestStatement.class)).setLevel(ch.qos.logback.classic.Level.OFF);
	((ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(Quest.class)).setLevel(ch.qos.logback.classic.Level.OFF);
	((ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(QuestQueryProcessor.class)).setLevel(ch.qos.logback.classic.Level.OFF);
	((ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(SparqlAlgebraToDatalogTranslator.class)).setLevel(ch.qos.logback.classic.Level.OFF);
	((ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(QuestOWL.class)).setLevel(ch.qos.logback.classic.Level.OFF);
	((ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(QuestUnfolder.class)).setLevel(ch.qos.logback.classic.Level.OFF);
	((ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(SQLQueryDeepParser.class)).setLevel(ch.qos.logback.classic.Level.OFF);
	((ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(OBDAModelImpl.class)).setLevel(ch.qos.logback.classic.Level.OFF);
	((ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(TripleLogger.class)).setLevel(ch.qos.logback.classic.Level.OFF);
	((ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(OWLAPITranslatorUtility.class)).setLevel(ch.qos.logback.classic.Level.OFF);
	((ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(OWLAPITranslatorOWL2QL.class)).setLevel(ch.qos.logback.classic.Level.OFF);
	((ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(MappingVocabularyRepair.class)).setLevel(ch.qos.logback.classic.Level.OFF);
	((ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(QueryParserRegistry.class)).setLevel(ch.qos.logback.classic.Level.OFF);
	((ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(DatalogUnfolder.class)).setLevel(ch.qos.logback.classic.Level.OFF);
	((ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(TableNameVisitor.class)).setLevel(ch.qos.logback.classic.Level.OFF);
}
 
开发者ID:onprom,项目名称:onprom,代码行数:19,代码来源:XESLogExtractorExperimental.java

示例9: enableAllOntopLogger

import ch.qos.logback.classic.Level; //导入依赖的package包/类
public void enableAllOntopLogger(){
	
	((ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(QuestStatement.class)).setLevel(ch.qos.logback.classic.Level.ALL);
	((ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(Quest.class)).setLevel(ch.qos.logback.classic.Level.ALL);
	((ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(QuestQueryProcessor.class)).setLevel(ch.qos.logback.classic.Level.ALL);
	((ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(SparqlAlgebraToDatalogTranslator.class)).setLevel(ch.qos.logback.classic.Level.ALL);
	((ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(QuestOWL.class)).setLevel(ch.qos.logback.classic.Level.ALL);
	((ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(QuestUnfolder.class)).setLevel(ch.qos.logback.classic.Level.ALL);
	((ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(SQLQueryDeepParser.class)).setLevel(ch.qos.logback.classic.Level.ALL);
	((ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(OBDAModelImpl.class)).setLevel(ch.qos.logback.classic.Level.ALL);
	((ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(TripleLogger.class)).setLevel(ch.qos.logback.classic.Level.ALL);
	((ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(OWLAPITranslatorUtility.class)).setLevel(ch.qos.logback.classic.Level.ALL);
	((ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(OWLAPITranslatorOWL2QL.class)).setLevel(ch.qos.logback.classic.Level.ALL);
	((ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(MappingVocabularyRepair.class)).setLevel(ch.qos.logback.classic.Level.ALL);
	((ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(QueryParserRegistry.class)).setLevel(ch.qos.logback.classic.Level.ALL);
	((ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(DatalogUnfolder.class)).setLevel(ch.qos.logback.classic.Level.ALL);
	((ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(TableNameVisitor.class)).setLevel(ch.qos.logback.classic.Level.ALL);
}
 
开发者ID:onprom,项目名称:onprom,代码行数:19,代码来源:XESLogExtractor.java

示例10: warmUp

import ch.qos.logback.classic.Level; //导入依赖的package包/类
@Before
public void warmUp() throws CoapException {
    ((Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME)).setLevel(Level.ERROR);

    packet = new CoapPacket(Method.GET, MessageType.Confirmable, "/path-pppppppppppppppppp1/path-dddddddddd-2/dfdshffsdkjfhsdks3/444444444444444444444444444444444444444/55555555555555555555555555555555555555555555555", null);
    packet.setMessageId(1234);
    packet.setToken(new byte[]{1, 2, 3, 4, 5});
    packet.headers().setMaxAge(4321L);
    packet.headers().setEtag(new byte[]{89, 10, 31, 7, 1});
    packet.headers().setObserve(9876);
    packet.headers().setBlock1Req(new BlockOption(13, BlockSize.S_16, true));
    packet.headers().setContentFormat(MediaTypes.CT_APPLICATION_XML);
    packet.headers().setLocationPath("/1/222/33333/4444444/555555555555555555555555");
    packet.headers().setUriQuery("ppar=val1&par222222222222222222222=val2222222222222222222222222222222222");
    packet.setPayload("<k>12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890</k>");

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    packet.writeTo(baos);
    CoapPacket.deserialize(null, new ByteArrayInputStream(baos.toByteArray()));

    System.out.println("MSG SIZE: " + packet.toByteArray().length);
}
 
开发者ID:ARMmbed,项目名称:java-coap,代码行数:23,代码来源:ParsingBenchmark.java

示例11: configure

import ch.qos.logback.classic.Level; //导入依赖的package包/类
@Override
public void configure(final LoggerContext lc) {

    final ConsoleAppender<ILoggingEvent> ca = new ConsoleAppender<>();
    ca.setContext(lc);
    ca.setName("console");
    final LayoutWrappingEncoder<ILoggingEvent> encoder = new LayoutWrappingEncoder<>();
    encoder.setContext(lc);
    final TTLLLayout layout = new TTLLLayout();
    layout.setContext(lc);
    layout.start();
    encoder.setLayout(layout);
    ca.setEncoder(encoder);
    ca.start();
    final Logger rootLogger = lc.getLogger("ROOT");
    rootLogger.setLevel(Level.WARN);
    rootLogger.addAppender(ca);
}
 
开发者ID:trajano,项目名称:app-ms,代码行数:19,代码来源:LogConfigurator.java

示例12: setUp

import ch.qos.logback.classic.Level; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    final Logger logger = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
    logger.addAppender(mockAppender);
    logger.setLevel(Level.INFO);

    signature = Optional.of(SignatureBuilder.aSignature().build());
    SignatureImpl signatureImpl = ((SignatureImpl) signature.get());
    signatureImpl.setXMLSignature(BuilderHelper.createXMLSignature(SIGNATURE_RSASHA256, DIGEST_SHA256));

    signatureWithUnknownSignatureAlgorithm = Optional.of(SignatureBuilder.aSignature().withSignatureAlgorithm(SIGNATURE_RSASHA1).build());
    SignatureImpl signatureWithUnknownSignatureAlgorithmImpl = ((SignatureImpl) signatureWithUnknownSignatureAlgorithm.get());
    signatureWithUnknownSignatureAlgorithmImpl.setXMLSignature(BuilderHelper.createXMLSignature(SIGNATURE_RSASHA1, DIGEST_SHA256));

    signatureWithUnknownDigestAlgorithm = Optional.of(SignatureBuilder.aSignature().withDigestAlgorithm(ID, DIGEST_SHA1).build());
    SignatureImpl signatureWithUnknownDigestAlgorithmImpl = ((SignatureImpl) signatureWithUnknownDigestAlgorithm.get());
    signatureWithUnknownDigestAlgorithmImpl.setXMLSignature(BuilderHelper.createXMLSignature(SIGNATURE_RSASHA256, DIGEST_SHA1));

    signatureWithUnknownSignatureAndDigestAlgorithms = Optional.of(SignatureBuilder.aSignature().withSignatureAlgorithm(SIGNATURE_RSASHA1).withDigestAlgorithm(ID, DIGEST_SHA1).build());
    SignatureImpl signatureWithUnknownSignatureAndDigestAlgorithmsImpl = ((SignatureImpl) signatureWithUnknownSignatureAndDigestAlgorithms.get());
    signatureWithUnknownSignatureAndDigestAlgorithmsImpl.setXMLSignature(BuilderHelper.createXMLSignature(SIGNATURE_RSASHA1, DIGEST_SHA1));
}
 
开发者ID:alphagov,项目名称:verify-hub,代码行数:23,代码来源:UnknownMethodAlgorithmLoggerTest.java

示例13: configure

import ch.qos.logback.classic.Level; //导入依赖的package包/类
@Override
public void configure(LoggerContext loggerContext) {
    addInfo("Setting up default configuration.");

    NonMetricsConsoleAppender nonMetricsConsoleAppender = new NonMetricsConsoleAppender();
    nonMetricsConsoleAppender.setContext(loggerContext);
    nonMetricsConsoleAppender.setName("CONSOLE");
    nonMetricsConsoleAppender.start();

    MetricsConsoleAppender metricsConsoleAppender = new MetricsConsoleAppender();
    metricsConsoleAppender.setContext(loggerContext);
    metricsConsoleAppender.setName("METRICS");
    metricsConsoleAppender.start();

    Logger rootLogger = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
    rootLogger.setLevel(Level.INFO);
    rootLogger.addAppender(nonMetricsConsoleAppender);
    rootLogger.addAppender(metricsConsoleAppender);
}
 
开发者ID:symphoniacloud,项目名称:lambda-monitoring,代码行数:20,代码来源:DefaultMetricsLogbackConfigurator.java

示例14: readLogEntriesFromDiskSetLevelCorrectly

import ch.qos.logback.classic.Level; //导入依赖的package包/类
@Test
public void readLogEntriesFromDiskSetLevelCorrectly() {
    log = new LogImpl(logfile);
    Logger testLogger = log.getLogger("my-test-context");
    String[] messages = {"info message", "warn message", "error message"};
    testLogger.info(messages[0]);
    testLogger.warn(messages[1]);
    testLogger.error(messages[2]);
    Log readFromDiskLog = new LogImpl(logfile);
    List<LogEntry> logEntries = readFromDiskLog.getLogEntries(0);
    assertEquals(3, logEntries.size());
    assertTrue(logEntries.get(0).getMessage().contains(messages[0]));
    assertEquals(Level.INFO.toString(), logEntries.get(0).getLevel());
    assertTrue(logEntries.get(1).getMessage().contains(messages[1]));
    assertEquals(Level.WARN.toString(), logEntries.get(1).getLevel());
    assertTrue(logEntries.get(2).getMessage().contains(messages[2]));
    assertEquals(Level.ERROR.toString(), logEntries.get(2).getLevel());
}
 
开发者ID:StuPro-TOSCAna,项目名称:TOSCAna,代码行数:19,代码来源:LogImplTest.java

示例15: logReadsLogfileWithStacktraces

import ch.qos.logback.classic.Level; //导入依赖的package包/类
@Test
public void logReadsLogfileWithStacktraces() {
    log = new LogImpl(logfile);
    Logger testLogger = log.getLogger(getClass());
    try {
        throw new ArithmeticException();
    } catch (ArithmeticException e) {
        testLogger.error("printing stacktrace to log", e);
    }
    Log readFromDiskLog = new LogImpl(logfile);
    List<LogEntry> logEntries = readFromDiskLog.getLogEntries(0);
    for (int index = 0; index < logEntries.size(); index++) {
        LogEntry entry = logEntries.get(index);
        assertNotEquals(0, entry.getTimestamp());
        assertEquals(index, entry.getIndex());
        assertEquals(Level.ERROR.toString(), entry.getLevel());
    }
}
 
开发者ID:StuPro-TOSCAna,项目名称:TOSCAna,代码行数:19,代码来源:LogImplTest.java


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