當前位置: 首頁>>代碼示例>>Java>>正文


Java LoggerFactory.getILoggerFactory方法代碼示例

本文整理匯總了Java中org.slf4j.LoggerFactory.getILoggerFactory方法的典型用法代碼示例。如果您正苦於以下問題:Java LoggerFactory.getILoggerFactory方法的具體用法?Java LoggerFactory.getILoggerFactory怎麽用?Java LoggerFactory.getILoggerFactory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.slf4j.LoggerFactory的用法示例。


在下文中一共展示了LoggerFactory.getILoggerFactory方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initializeLogback

import org.slf4j.LoggerFactory; //導入方法依賴的package包/類
@PostConstruct
public void initializeLogback() {
    LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
    InputStream is = InitLogback.class.getClassLoader().getResourceAsStream("tasfe-logback.xml");
    if (is == null)
        return;
    JoranConfigurator configurator = new JoranConfigurator();
    configurator.setContext(lc);
    lc.reset();

    try {
        configurator.doConfigure(is);
    } catch (JoranException e) {
        e.printStackTrace();
    }
}
 
開發者ID:geeker-lait,項目名稱:tasfe-framework,代碼行數:17,代碼來源:InitLogback.java

示例2: getList

import org.slf4j.LoggerFactory; //導入方法依賴的package包/類
@GetMapping("/logs")
@Timed
public List<LoggerVM> getList() {
    LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
    return context.getLoggerList()
        .stream()
        .map(LoggerVM::new)
        .collect(Collectors.toList());
}
 
開發者ID:deepu105,項目名稱:spring-io,代碼行數:10,代碼來源:LogsResource.java

示例3: changeLevel

import org.slf4j.LoggerFactory; //導入方法依賴的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:AppertaFoundation,項目名稱:Code4Health-Platform,代碼行數:8,代碼來源:LogsResource.java

示例4: connect

import org.slf4j.LoggerFactory; //導入方法依賴的package包/類
private static void connect(String URI){
    //Change MongoDB's logger settings
    LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
    rootLogger = loggerContext.getLogger("org.mongodb.driver");
    rootLogger.setLevel(Level.INFO);

    //Setup Connection
    MongoClientURI connectionString = new MongoClientURI(URI);
    MongoClient mongoClient = new MongoClient(connectionString);
    MongoDatabase database = mongoClient.getDatabase("media_information_service_db");
    collection = database.getCollection("messages");

}
 
開發者ID:LithiumSR,項目名稱:media_information_service,代碼行數:14,代碼來源:MongoDBInterface.java

示例5: execute

import org.slf4j.LoggerFactory; //導入方法依賴的package包/類
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
    if (clientRegistry.getClients().isEmpty()) {
        log.warn("No bots to track data for");
    }
    for (Map.Entry<Bot, IDiscordClient> entry : clientRegistry.getClients().entrySet()) {
        IDiscordClient client = entry.getValue();
        if (client.isReady()) {
            String botTag = "bot:" + entry.getKey().getName();
            for (IShard shard : client.getShards()) {
                String shardTag = "shard:" + shard.getInfo()[0];
                long millis = shard.getResponseTime();
                metricRegistry.timer("discord.ws.response[" + botTag + "," + shardTag + "]")
                    .update(millis, TimeUnit.MILLISECONDS);
            }
            for (IGuild guild : client.getGuilds()) {
                String guildTag = "guild:" + guild.getStringID();
                long online = guild.getUsers().stream()
                    .filter(user -> user.getPresence().getStatus() == StatusType.ONLINE)
                    .count();
                long connected = guild.getUsers().stream()
                    .filter(user -> user.getPresence().getStatus() != StatusType.OFFLINE)
                    .count();
                long joined = guild.getUsers().size();
                String onlineMetric = "discord.ws.users[" + botTag + "," + guildTag + "," + "status:online]";
                String connectedMetric = "discord.ws.users[" + botTag + "," + guildTag + "," + "status:connected]";
                String joinedMetric = "discord.ws.users[" + botTag + "," + guildTag + "," + "status:joined]";
                metricRegistry.histogram(onlineMetric).update(online);
                metricRegistry.histogram(connectedMetric).update(connected);
                metricRegistry.histogram(joinedMetric).update(joined);
            }

         LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
         loggerContext.getLogger("org.eclipse.jetty.websocket").setLevel(Level.WARN);
         loggerContext.getLogger(Discord4J.class).setLevel(Level.DEBUG);
        } else {
            log.warn("Bot {} is not ready!", entry.getKey().getName());
        }
    }
}
 
開發者ID:quanticc,項目名稱:sentry,代碼行數:41,代碼來源:BotCheck.java

示例6: init

import org.slf4j.LoggerFactory; //導入方法依賴的package包/類
@PostConstruct
public void init() {
    LOG.info("Send SQL log: " + sendSqllog);
    if (!sendSqllog) {
        return;
    }
    LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
    List<String> loggerNames = Arrays.asList("jp.co.future.uroborosql.AbstractAgent", "jp.co.future.uroborosql.filter.DebugSqlFilter");
    context.getLoggerList().stream()
        .filter(logger -> loggerNames.contains(logger.getName()))
        .forEach(logger -> logger.addAppender(SqlLogAppender.this));
    setContext(context);
    start();
}
 
開發者ID:shout-star,項目名稱:uroborosql-springboot-demo,代碼行數:15,代碼來源:SqlLogAppender.java

示例7: addSampleLogger

import org.slf4j.LoggerFactory; //導入方法依賴的package包/類
/**
 * Allow only selected logger to print DEBUG events to STDOUT and FILE.
 * Other loggers are allowed to print ERRORS only.
 */
private static void addSampleLogger(final String loggerName) {
    if (CUSTOM_FILTER == null) {
        CUSTOM_FILTER = new CustomFilter();
        final LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();

        Appender ca = loggerContext.getLogger("ROOT").getAppender("STDOUT");
        ca.clearAllFilters();
        ca.addFilter(CUSTOM_FILTER);
    }
    CUSTOM_FILTER.addVisibleLogger(loggerName);
}
 
開發者ID:Aptoide,項目名稱:AppCoins-ethereumj,代碼行數:16,代碼來源:BasicSample.java

示例8: initLogback

import org.slf4j.LoggerFactory; //導入方法依賴的package包/類
private static void initLogback() throws JoranException {
    String rocketmqHome = System.getProperty(MixAll.ROCKETMQ_HOME_PROPERTY, System.getenv(MixAll.ROCKETMQ_HOME_ENV));

    LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
    JoranConfigurator configurator = new JoranConfigurator();
    configurator.setContext(lc);
    lc.reset();
    configurator.doConfigure(rocketmqHome + "/conf/logback_tools.xml");
}
 
開發者ID:y123456yz,項目名稱:reading-and-annotate-rocketmq-3.4.6,代碼行數:10,代碼來源:MQAdminStartup.java

示例9: getList

import org.slf4j.LoggerFactory; //導入方法依賴的package包/類
@GetMapping("/logs")
public List<LoggerVM> getList() {
    LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
    return context.getLoggerList()
        .stream()
        .map(LoggerVM::new)
        .collect(Collectors.toList());
}
 
開發者ID:Cinderpup,項目名稱:RoboInsta,代碼行數:9,代碼來源:LogsResource.java

示例10: changeLevel

import org.slf4j.LoggerFactory; //導入方法依賴的package包/類
@PutMapping("/logs")
@Timed
public void changeLevel(@RequestBody LoggerDTO jsonLogger) {
    LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
    context.getLogger(jsonLogger.getName()).setLevel(Level.valueOf(jsonLogger.getLevel()));
}
 
開發者ID:mraible,項目名稱:devoxxus-jhipster-microservices-demo,代碼行數:7,代碼來源:LogsResource.java

示例11: turnOffSentry

import org.slf4j.LoggerFactory; //導入方法依賴的package包/類
private void turnOffSentry() {
    LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
    SentryAppender sentryAppender = (SentryAppender) lc.getLogger(Logger.ROOT_LOGGER_NAME).getAppender("SENTRY");
    Sentry.close();
    sentryAppender.stop();
}
 
開發者ID:Frederikam,項目名稱:Lavalink,代碼行數:7,代碼來源:Launcher.java

示例12: testLogstashAppender

import org.slf4j.LoggerFactory; //導入方法依賴的package包/類
@Test
public void testLogstashAppender() {
    LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
    assertThat(context.getLogger("ROOT").getAppender("ASYNC_LOGSTASH")).isInstanceOf(AsyncAppender.class);
}
 
開發者ID:xm-online,項目名稱:xm-ms-timeline,代碼行數:6,代碼來源:LogsResourceIntTest.java

示例13: testSlf4jFactorySet

import org.slf4j.LoggerFactory; //導入方法依賴的package包/類
@Test
public void testSlf4jFactorySet() throws Exception {
    ILoggerFactory factory = LoggerFactory.getILoggerFactory();
    assertThat(factory).isInstanceOf(Log4jLoggerFactory.class);
}
 
開發者ID:apache,項目名稱:logging-log4j-boot,代碼行數:6,代碼來源:LoggingInitializerTest.java


注:本文中的org.slf4j.LoggerFactory.getILoggerFactory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。