本文整理匯總了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);
}
}
示例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();
}
示例3: activateDebugLoggingConfig
import org.pmw.tinylog.LoggingLevel; //導入依賴的package包/類
/**
* Configure at TRACE logging level
*/
public static void activateDebugLoggingConfig()
{
activateLoggingConfig( LoggingLevel.TRACE );
}
示例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
}