本文整理汇总了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
}