當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。