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


Java LoggingLevel类代码示例

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


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

示例1: AccessLog

import org.pmw.tinylog.LoggingLevel; //导入依赖的package包/类
/**
 * In the constructor the callbacks and the logging configuration are initialized.
 *
 * @param callbackRegistry injected HiveMQ Callback Registry
 */
@Inject
public AccessLog(CallbackRegistry callbackRegistry) {

    try {
        Configurator.defaultConfig()
                .writer(new RollingFileWriter(new File(PathUtils.getHiveMQLogFolder(), "hivemq-access.log").getAbsolutePath(), 10, new TimestampLabeller("yyyMMdd"), new DailyPolicy()))
                .level(LoggingLevel.INFO)
                .formatPattern("{date:yyyy-MM-dd HH:mm:ss}  {message}")
                .activate();

        callbackRegistry.addCallback(onConnectCallback());
        callbackRegistry.addCallback(disconnectCallback());
        callbackRegistry.addCallback(onSubscribe());
        callbackRegistry.addCallback(onPublish());
        callbackRegistry.addCallback(onUnsubscribeCallback());
    } catch (IOException e) {
        log.error("An error occured while configuring the AccessLogger. No Callbacks registered", e);
    }
}
 
开发者ID:hivemq,项目名称:access-log-plugin,代码行数:25,代码来源:AccessLog.java

示例2: activateLoggingConfig

import org.pmw.tinylog.LoggingLevel; //导入依赖的package包/类
/**
 * Configure at the given logging level
 */
public static void activateLoggingConfig( LoggingLevel logLevel )
{
    String formatPattern = "{date:yyyy-MM-dd HH:mm:ss.SSS} [{thread}] {class}.{method}()  {level}: {message}";
    Configurator.defaultConfig().level( logLevel ).formatPattern( formatPattern ).activate();
}
 
开发者ID:ASzc,项目名称:keratin-irc,代码行数:9,代码来源:Logging.java

示例3: activateDebugLoggingConfig

import org.pmw.tinylog.LoggingLevel; //导入依赖的package包/类
/**
 * Configure at TRACE logging level
 */
public static void activateDebugLoggingConfig()
{
    activateLoggingConfig( LoggingLevel.TRACE );
}
 
开发者ID:ASzc,项目名称:keratin-irc,代码行数:8,代码来源:Logging.java

示例4: main

import org.pmw.tinylog.LoggingLevel; //导入依赖的package包/类
public static void main( String[] args )
{
    // Logging
    LoggingLevel logLevel = LoggingLevel.valueOf( cfg.get( "logLevel" ) );
    Logging.activateLoggingConfig( logLevel );

    Logger.trace( "Got config: " + cfg );

    // Database
    String redisHost = cfg.get( "redisHost" );
    int redisPort = Integer.parseInt( cfg.get( "redisPort" ) );
    pool = new JedisPool( new JedisPoolConfig(), redisHost, redisPort );

    Runtime.getRuntime().addShutdownHook( new Thread()
    {
        public void run()
        {
            pool.destroy();
        }
    } );

    BaseNick.setPrimaryBotNick( cfg.get( "ircNick1" ) );

    // Bot
    int ircBotAmount = Integer.parseInt( cfg.get( "ircBotAmount" ) );
    for ( int i = 1; i <= ircBotAmount; i++ )
    {
        String ircUser = cfg.get( "ircUser" + i );
        String ircNick = cfg.get( "ircNick" + i );
        String ircRealName = cfg.get( "ircRealName" + i );
        String ircServerAddress = cfg.get( "ircServerAddress" + i );
        int ircPort = Integer.parseInt( cfg.get( "ircPort" + i ) );
        SslMode ircSslMode = SslMode.valueOf( cfg.get( "ircSslMode" + i ) );
        String ircChannel = cfg.get( "ircChannel" + i );
        boolean ircChannelAutoOp = Boolean.parseBoolean( cfg.get( "ircChannelAutoOp" + i ) );

        BaseNick.addBotNick( ircNick );

        KeratinBot keratinBot = new KeratinBot();
        keratinBot.setUser( ircUser );
        keratinBot.setNick( ircNick );
        keratinBot.setRealName( ircRealName );
        keratinBot.setServerAddress( ircServerAddress );
        keratinBot.setServerPort( ircPort );
        keratinBot.setSslMode( ircSslMode );
        keratinBot.addChannel( ircChannel );

        if ( !ircChannelAutoOp )
            Ignore.addAutoOp( ircChannel );

        keratinBot.connect();
    }

    // Done
}
 
开发者ID:oldterns,项目名称:VileBot,代码行数:56,代码来源:Vilebot.java


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