本文整理汇总了Java中ch.qos.logback.classic.android.LogcatAppender.setTagEncoder方法的典型用法代码示例。如果您正苦于以下问题:Java LogcatAppender.setTagEncoder方法的具体用法?Java LogcatAppender.setTagEncoder怎么用?Java LogcatAppender.setTagEncoder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ch.qos.logback.classic.android.LogcatAppender
的用法示例。
在下文中一共展示了LogcatAppender.setTagEncoder方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initLog
import ch.qos.logback.classic.android.LogcatAppender; //导入方法依赖的package包/类
private void initLog(){
final File logDir = getLogDir();
final File logFile = new File(logDir, "chaincloud-v.log");
final LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
final PatternLayoutEncoder filePattern = new PatternLayoutEncoder();
filePattern.setContext(context);
filePattern.setPattern("%d{HH:mm:ss.SSS} [%thread] %logger{0} - %msg%n");
filePattern.start();
final RollingFileAppender<ILoggingEvent> fileAppender = new
RollingFileAppender<ILoggingEvent>();
fileAppender.setContext(context);
fileAppender.setFile(logFile.getAbsolutePath());
final TimeBasedRollingPolicy<ILoggingEvent> rollingPolicy = new
TimeBasedRollingPolicy<ILoggingEvent>();
rollingPolicy.setContext(context);
rollingPolicy.setParent(fileAppender);
rollingPolicy.setFileNamePattern(logDir.getAbsolutePath() + "/chaincloud-v.%d.log.gz");
rollingPolicy.setMaxHistory(7);
rollingPolicy.start();
fileAppender.setEncoder(filePattern);
fileAppender.setRollingPolicy(rollingPolicy);
fileAppender.start();
final PatternLayoutEncoder logcatTagPattern = new PatternLayoutEncoder();
logcatTagPattern.setContext(context);
logcatTagPattern.setPattern("%logger{0}");
logcatTagPattern.start();
final PatternLayoutEncoder logcatPattern = new PatternLayoutEncoder();
logcatPattern.setContext(context);
logcatPattern.setPattern("[%thread] %msg%n");
logcatPattern.start();
final LogcatAppender logcatAppender = new LogcatAppender();
logcatAppender.setContext(context);
logcatAppender.setTagEncoder(logcatTagPattern);
logcatAppender.setEncoder(logcatPattern);
logcatAppender.start();
final ch.qos.logback.classic.Logger log = context.getLogger(Logger.ROOT_LOGGER_NAME);
log.addAppender(fileAppender);
log.addAppender(logcatAppender);
log.setLevel(Level.INFO);
}
示例2: initLogging
import ch.qos.logback.classic.android.LogcatAppender; //导入方法依赖的package包/类
private void initLogging()
{
final File logDir = getDir("log", Constants.TEST ? Context.MODE_WORLD_READABLE : MODE_PRIVATE);
final File logFile = new File(logDir, "wallet.log");
final LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
final PatternLayoutEncoder filePattern = new PatternLayoutEncoder();
filePattern.setContext(context);
filePattern.setPattern("%d{HH:mm:ss.SSS} [%thread] %logger{0} - %msg%n");
filePattern.start();
final RollingFileAppender<ILoggingEvent> fileAppender = new RollingFileAppender<ILoggingEvent>();
fileAppender.setContext(context);
fileAppender.setFile(logFile.getAbsolutePath());
final TimeBasedRollingPolicy<ILoggingEvent> rollingPolicy = new TimeBasedRollingPolicy<ILoggingEvent>();
rollingPolicy.setContext(context);
rollingPolicy.setParent(fileAppender);
rollingPolicy.setFileNamePattern(logDir.getAbsolutePath() + "/wallet.%d.log.gz");
rollingPolicy.setMaxHistory(7);
rollingPolicy.start();
fileAppender.setEncoder(filePattern);
fileAppender.setRollingPolicy(rollingPolicy);
fileAppender.start();
final PatternLayoutEncoder logcatTagPattern = new PatternLayoutEncoder();
logcatTagPattern.setContext(context);
logcatTagPattern.setPattern("%logger{0}");
logcatTagPattern.start();
final PatternLayoutEncoder logcatPattern = new PatternLayoutEncoder();
logcatPattern.setContext(context);
logcatPattern.setPattern("[%thread] %msg%n");
logcatPattern.start();
final LogcatAppender logcatAppender = new LogcatAppender();
logcatAppender.setContext(context);
logcatAppender.setTagEncoder(logcatTagPattern);
logcatAppender.setEncoder(logcatPattern);
logcatAppender.start();
final ch.qos.logback.classic.Logger log = context.getLogger(Logger.ROOT_LOGGER_NAME);
log.addAppender(fileAppender);
log.addAppender(logcatAppender);
log.setLevel(Level.INFO);
}
示例3: initLogging
import ch.qos.logback.classic.android.LogcatAppender; //导入方法依赖的package包/类
private void initLogging()
{
final File logDir = getDir("log", TEST ? Context.MODE_WORLD_READABLE : MODE_PRIVATE);
final File logFile = new File(logDir, "wallet.log");
final LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
final PatternLayoutEncoder filePattern = new PatternLayoutEncoder();
filePattern.setContext(context);
filePattern.setPattern("%d{HH:mm:ss.SSS} [%thread] %logger{0} - %msg%n");
filePattern.start();
final RollingFileAppender<ILoggingEvent> fileAppender = new RollingFileAppender<ILoggingEvent>();
fileAppender.setContext(context);
fileAppender.setFile(logFile.getAbsolutePath());
final TimeBasedRollingPolicy<ILoggingEvent> rollingPolicy = new TimeBasedRollingPolicy<ILoggingEvent>();
rollingPolicy.setContext(context);
rollingPolicy.setParent(fileAppender);
rollingPolicy.setFileNamePattern(logDir.getAbsolutePath() + "/wallet.%d.log.gz");
rollingPolicy.setMaxHistory(7);
rollingPolicy.start();
fileAppender.setEncoder(filePattern);
fileAppender.setRollingPolicy(rollingPolicy);
fileAppender.start();
final PatternLayoutEncoder logcatTagPattern = new PatternLayoutEncoder();
logcatTagPattern.setContext(context);
logcatTagPattern.setPattern("%logger{0}");
logcatTagPattern.start();
final PatternLayoutEncoder logcatPattern = new PatternLayoutEncoder();
logcatPattern.setContext(context);
logcatPattern.setPattern("[%thread] %msg%n");
logcatPattern.start();
final LogcatAppender logcatAppender = new LogcatAppender();
logcatAppender.setContext(context);
logcatAppender.setTagEncoder(logcatTagPattern);
logcatAppender.setEncoder(logcatPattern);
logcatAppender.start();
final ch.qos.logback.classic.Logger log = context.getLogger(Logger.ROOT_LOGGER_NAME);
log.addAppender(fileAppender);
log.addAppender(logcatAppender);
log.setLevel(Level.INFO);
}
示例4: initLogging
import ch.qos.logback.classic.android.LogcatAppender; //导入方法依赖的package包/类
private void initLogging() {
final File logDir = getLogDir();
final File logFile = new File(logDir, "bitherj.log");
final LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
final PatternLayoutEncoder filePattern = new PatternLayoutEncoder();
filePattern.setContext(context);
filePattern.setPattern("%d{HH:mm:ss.SSS} [%thread] %logger{0} - %msg%n");
filePattern.start();
final RollingFileAppender<ILoggingEvent> fileAppender = new
RollingFileAppender<ILoggingEvent>();
fileAppender.setContext(context);
fileAppender.setFile(logFile.getAbsolutePath());
final TimeBasedRollingPolicy<ILoggingEvent> rollingPolicy = new
TimeBasedRollingPolicy<ILoggingEvent>();
rollingPolicy.setContext(context);
rollingPolicy.setParent(fileAppender);
rollingPolicy.setFileNamePattern(logDir.getAbsolutePath() + "/bitherj.%d.log.gz");
rollingPolicy.setMaxHistory(7);
rollingPolicy.start();
fileAppender.setEncoder(filePattern);
fileAppender.setRollingPolicy(rollingPolicy);
fileAppender.start();
final PatternLayoutEncoder logcatTagPattern = new PatternLayoutEncoder();
logcatTagPattern.setContext(context);
logcatTagPattern.setPattern("%logger{0}");
logcatTagPattern.start();
final PatternLayoutEncoder logcatPattern = new PatternLayoutEncoder();
logcatPattern.setContext(context);
logcatPattern.setPattern("[%thread] %msg%n");
logcatPattern.start();
final LogcatAppender logcatAppender = new LogcatAppender();
logcatAppender.setContext(context);
logcatAppender.setTagEncoder(logcatTagPattern);
logcatAppender.setEncoder(logcatPattern);
logcatAppender.start();
final ch.qos.logback.classic.Logger log = context.getLogger(Logger.ROOT_LOGGER_NAME);
log.addAppender(fileAppender);
log.addAppender(logcatAppender);
log.setLevel(Level.INFO);
}
示例5: initLogging
import ch.qos.logback.classic.android.LogcatAppender; //导入方法依赖的package包/类
private void initLogging()
{
final File logDir = getDir("log", MODE_PRIVATE); // Context.MODE_WORLD_READABLE
final File logFile = new File(logDir, "btcreceive.log");
final LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
final PatternLayoutEncoder filePattern = new PatternLayoutEncoder();
filePattern.setContext(context);
filePattern.setPattern("%d{HH:mm:ss.SSS} [%thread] %logger{0} - %msg%n");
filePattern.start();
final RollingFileAppender<ILoggingEvent> fileAppender = new RollingFileAppender<ILoggingEvent>();
fileAppender.setContext(context);
fileAppender.setFile(logFile.getAbsolutePath());
final TimeBasedRollingPolicy<ILoggingEvent> rollingPolicy = new TimeBasedRollingPolicy<ILoggingEvent>();
rollingPolicy.setContext(context);
rollingPolicy.setParent(fileAppender);
rollingPolicy.setFileNamePattern(logDir.getAbsolutePath() + "/btcreceive.%d.log.gz");
rollingPolicy.setMaxHistory(7);
rollingPolicy.start();
fileAppender.setEncoder(filePattern);
fileAppender.setRollingPolicy(rollingPolicy);
fileAppender.start();
final PatternLayoutEncoder logcatTagPattern = new PatternLayoutEncoder();
logcatTagPattern.setContext(context);
logcatTagPattern.setPattern("%logger{0}");
logcatTagPattern.start();
final PatternLayoutEncoder logcatPattern = new PatternLayoutEncoder();
logcatPattern.setContext(context);
logcatPattern.setPattern("[%thread] %msg%n");
logcatPattern.start();
final LogcatAppender logcatAppender = new LogcatAppender();
logcatAppender.setContext(context);
logcatAppender.setTagEncoder(logcatTagPattern);
logcatAppender.setEncoder(logcatPattern);
logcatAppender.start();
final ch.qos.logback.classic.Logger log = context.getLogger(Logger.ROOT_LOGGER_NAME);
log.addAppender(fileAppender);
log.addAppender(logcatAppender);
log.setLevel(Level.INFO);
}
示例6: initLogging
import ch.qos.logback.classic.android.LogcatAppender; //导入方法依赖的package包/类
private void initLogging()
{
final File logDir = getDir("log", Constants.TEST ? Context.MODE_WORLD_READABLE : MODE_PRIVATE);
final File logFile = new File(logDir, "wallet.log");
final LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
final PatternLayoutEncoder filePattern = new PatternLayoutEncoder();
filePattern.setContext(context);
filePattern.setPattern("%d{HH:mm:ss.SSS} [%thread] %logger{0} - %msg%n");
filePattern.start();
final RollingFileAppender<ILoggingEvent> fileAppender = new RollingFileAppender<ILoggingEvent>();
fileAppender.setContext(context);
fileAppender.setFile(logFile.getAbsolutePath());
final TimeBasedRollingPolicy<ILoggingEvent> rollingPolicy = new TimeBasedRollingPolicy<ILoggingEvent>();
rollingPolicy.setContext(context);
rollingPolicy.setParent(fileAppender);
rollingPolicy.setFileNamePattern(logDir.getAbsolutePath() + "/wallet.%d.log.gz");
rollingPolicy.setMaxHistory(7);
rollingPolicy.start();
fileAppender.setEncoder(filePattern);
fileAppender.setRollingPolicy(rollingPolicy);
fileAppender.start();
final PatternLayoutEncoder logcatTagPattern = new PatternLayoutEncoder();
logcatTagPattern.setContext(context);
logcatTagPattern.setPattern("%logger{0}");
logcatTagPattern.start();
final PatternLayoutEncoder logcatPattern = new PatternLayoutEncoder();
logcatPattern.setContext(context);
logcatPattern.setPattern("[%thread] %msg%n");
logcatPattern.start();
final LogcatAppender logcatAppender = new LogcatAppender();
logcatAppender.setContext(context);
logcatAppender.setTagEncoder(logcatTagPattern);
logcatAppender.setEncoder(logcatPattern);
logcatAppender.start();
final ch.qos.logback.classic.Logger log = context.getLogger(Logger.ROOT_LOGGER_NAME);
log.addAppender(fileAppender);
log.addAppender(logcatAppender);
log.setLevel(Level.INFO);
}
示例7: initLogs
import ch.qos.logback.classic.android.LogcatAppender; //导入方法依赖的package包/类
private static void initLogs() {
Logger logbackLogger = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
LoggerContext lc = logbackLogger.getLoggerContext();
Logger rootLogger = lc.getLogger(Logger.ROOT_LOGGER_NAME);
rootLogger.detachAndStopAllAppenders();
TimeBasedRollingPolicy<ILoggingEvent> rollingPolicy = new TimeBasedRollingPolicy<ILoggingEvent>();
rollingPolicy.setMaxHistory(3);
SizeAndTimeBasedFNATP<ILoggingEvent> sizeAndTimeBasedFNATP = new SizeAndTimeBasedFNATP<ILoggingEvent>();
sizeAndTimeBasedFNATP.setMaxFileSize("2MB");
rollingPolicy.setTimeBasedFileNamingAndTriggeringPolicy(sizeAndTimeBasedFNATP);
rollingPolicy.setFileNamePattern(context.getFilesDir().getPath() + "/logs/old/flickruploader.%d{yyyy-MM-dd}.%i.log");
rollingPolicy.setContext(lc);
RollingFileAppender<ILoggingEvent> fileAppender = new RollingFileAppender<ILoggingEvent>();
fileAppender.setContext(lc);
fileAppender.setFile(getLogFilePath());
fileAppender.setRollingPolicy(rollingPolicy);
fileAppender.setTriggeringPolicy(rollingPolicy);
rollingPolicy.setParent(fileAppender);
PatternLayoutEncoder pl = new PatternLayoutEncoder();
pl.setContext(lc);
pl.setCharset(Charset.defaultCharset());
pl.setPattern("%d{HH:mm:ss.SSS} [%thread] %-5level %class{0}.%method:%L > %msg%n");
pl.setImmediateFlush(false);
pl.start();
fileAppender.setEncoder(pl);
fileAppender.setName("file");
rollingPolicy.start();
fileAppender.start();
if (Config.isDebug()) {
final PatternLayoutEncoder logcatTagPattern = new PatternLayoutEncoder();
logcatTagPattern.setContext(lc);
logcatTagPattern.setPattern("%class{0}");
logcatTagPattern.start();
final PatternLayoutEncoder logcatPattern = new PatternLayoutEncoder();
logcatPattern.setContext(lc);
logcatPattern.setPattern("[%thread] %method:%L > %msg%n");
logcatPattern.start();
final LogcatAppender logcatAppender = new LogcatAppender();
logcatAppender.setContext(lc);
logcatAppender.setTagEncoder(logcatTagPattern);
logcatAppender.setEncoder(logcatPattern);
logcatAppender.start();
rootLogger.addAppender(logcatAppender);
}
rootLogger.addAppender(fileAppender);
}