当前位置: 首页>>代码示例>>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;未经允许,请勿转载。