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