本文整理汇总了Java中ch.qos.logback.classic.android.LogcatAppender.setContext方法的典型用法代码示例。如果您正苦于以下问题:Java LogcatAppender.setContext方法的具体用法?Java LogcatAppender.setContext怎么用?Java LogcatAppender.setContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ch.qos.logback.classic.android.LogcatAppender
的用法示例。
在下文中一共展示了LogcatAppender.setContext方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureLogbackDirectly
import ch.qos.logback.classic.android.LogcatAppender; //导入方法依赖的package包/类
private static void configureLogbackDirectly() {
// reset the default context (which may already have been initialized)
// since we want to reconfigure it
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
lc.reset();
// setup LogcatAppender
PatternLayoutEncoder encoder2 = new PatternLayoutEncoder();
encoder2.setContext(lc);
encoder2.setPattern("[%thread] %msg%n");
encoder2.start();
LogcatAppender logcatAppender = new LogcatAppender();
logcatAppender.setContext(lc);
logcatAppender.setEncoder(encoder2);
logcatAppender.start();
// backup the newly created appenders to the root logger;
// qualify Logger to disambiguate from org.slf4j.Logger
ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
root.addAppender(logcatAppender);
root.setLevel(Level.ALL);
}
示例2: init
import ch.qos.logback.classic.android.LogcatAppender; //导入方法依赖的package包/类
/**
* Called to initialize logging. Should be called in {@link android.app.Application#onCreate()}
*
* @param context
* @param writeToLogcat If {@code true} log messages will be written to logcat as well as
* to disk. If {@code false} log messages will only be written to disk.
* Apps should only ever write to logcat in development.
* @param pattern The log pattern to use. The default is {@link #DEFAULT_PATTERN}
*/
public static void init(Context context, boolean writeToLogcat, String pattern) {
LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
loggerContext.reset();
PatternLayoutEncoder encoder = new PatternLayoutEncoder();
encoder.setContext(loggerContext);
encoder.setPattern(pattern);
encoder.start();
FileAppender<ILoggingEvent> fileAppender = new FileAppender<ILoggingEvent>();
fileAppender.setContext(loggerContext);
fileAppender.setFile(getFilePath(context));
fileAppender.setAppend(true);
fileAppender.setEncoder(encoder);
fileAppender.start();
ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger)
LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
root.addAppender(fileAppender);
if (writeToLogcat) {
LogcatAppender logcatAppender = new LogcatAppender();
logcatAppender.setContext(loggerContext);
logcatAppender.setEncoder(encoder);
logcatAppender.start();
root.addAppender(logcatAppender);
}
}
示例3: 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);
}
示例4: 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);
}
示例5: configureLogger
import ch.qos.logback.classic.android.LogcatAppender; //导入方法依赖的package包/类
private void configureLogger() {
File targetFile = new File(LOGFILE_PATH);
// reset the default context (which may already have been initialized)
// since we want to reconfigure it
LoggerContext lc = (LoggerContext)LoggerFactory.getILoggerFactory();
lc.reset();
PatternLayoutEncoder encoder = new PatternLayoutEncoder();
encoder.setContext(lc);
encoder.setPattern("%d{yyyy-MM-dd HH:mm:ss.SSS} : %-5level : %msg%n");
encoder.start();
String filePattern = targetFile.getParent() + "/" + targetFile.getName() + ".%i.zip";
FixedWindowRollingPolicy rollingPolicy = new FixedWindowRollingPolicy();
rollingPolicy.setFileNamePattern(filePattern);
rollingPolicy.setMinIndex(1);
rollingPolicy.setMaxIndex(3);
rollingPolicy.setContext(lc);
SizeBasedTriggeringPolicy<ILoggingEvent> triggeringPolicy = new SizeBasedTriggeringPolicy<ILoggingEvent>();
triggeringPolicy.setMaxFileSize("5MB");
triggeringPolicy.setContext(lc);
RollingFileAppender<ILoggingEvent> rollingFileAppender = new RollingFileAppender<ILoggingEvent>();
rollingFileAppender.setAppend(true);
rollingFileAppender.setName("FILE");
rollingFileAppender.setContext(lc);
rollingFileAppender.setFile(LOGFILE_PATH);
rollingFileAppender.setRollingPolicy(rollingPolicy);
rollingFileAppender.setTriggeringPolicy(triggeringPolicy);
rollingFileAppender.setEncoder(encoder);
triggeringPolicy.start();
rollingPolicy.setParent(rollingFileAppender);
rollingPolicy.start();
rollingFileAppender.start();
// Logcat appender
LogcatAppender logcatAppender = new LogcatAppender();
logcatAppender.setContext(lc);
logcatAppender.setName("LOGCAT");
logcatAppender.setEncoder(encoder);
logcatAppender.start();
// add the newly created appenders to the root logger;
// qualify Logger to disambiguate from org.slf4j.Logger
ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
root.setLevel(Level.ALL);
root.addAppender(rollingFileAppender);
root.addAppender(logcatAppender);
}
示例6: 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);
}
示例7: configureLogbackDirectly
import ch.qos.logback.classic.android.LogcatAppender; //导入方法依赖的package包/类
private void configureLogbackDirectly() {
// reset the default context (which may already have been initialized)
// since we want to reconfigure it
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
lc.reset();
// setup FileAppender
PatternLayoutEncoder encoder1 = new PatternLayoutEncoder();
encoder1.setContext(lc);
encoder1.setPattern("%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n");
encoder1.start();
FileAppender<ILoggingEvent> fileAppender = new FileAppender<>();
fileAppender.setContext(lc);
fileAppender.setFile(this.getFileStreamPath("app.log").getAbsolutePath());
fileAppender.setEncoder(encoder1);
fileAppender.start();
// setup LogcatAppender
PatternLayoutEncoder encoder2 = new PatternLayoutEncoder();
encoder2.setContext(lc);
encoder2.setPattern("[%thread] %msg%n");
encoder2.start();
LogcatAppender logcatAppender = new LogcatAppender();
logcatAppender.setContext(lc);
logcatAppender.setEncoder(encoder2);
logcatAppender.start();
// backup the newly created appenders to the root logger;
// qualify Logger to disambiguate from org.slf4j.Logger
ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
root.addAppender(fileAppender);
root.addAppender(logcatAppender);
if (BuildConfig.DEBUG) {
root.setLevel(Level.ALL);
} else {
root.setLevel(Level.INFO);
}
}
示例8: 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);
}
示例9: 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);
}
示例10: 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);
}
示例11: initLogging
import ch.qos.logback.classic.android.LogcatAppender; //导入方法依赖的package包/类
/**
* Initialize and configure the logback logging.
* Java configuration is used to rely on {@link Context#getExternalFilesDir(String)} to provide a storage directory.
* This must be called on every "entry-point" to this app, e.g. Widget Configuration screen or MainActivity.
*
* @param context application context
*/
public static void initLogging(Context context) {
final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean isDebugLogging = sharedPrefs.getBoolean(SettingsActivity.KEY_PREF_DEBUG_LOGGING, false);
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
lc.reset();
// qualify Logger to disambiguate from org.slf4j.Logger
ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
root.setLevel(Level.TRACE);
PatternLayoutEncoder encoder1 = new PatternLayoutEncoder();
encoder1.setContext(lc);
encoder1.setPattern("%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n");
encoder1.start();
// setup LogcatAppender
PatternLayoutEncoder encoder2 = new PatternLayoutEncoder();
encoder2.setContext(lc);
encoder2.setPattern("[%thread] %msg%n");
encoder2.start();
LogcatAppender logcatAppender = new LogcatAppender();
logcatAppender.setContext(lc);
logcatAppender.setEncoder(encoder2);
logcatAppender.start();
// Log-Level for RaspiCheck
ch.qos.logback.classic.Logger rpicheckLogger = (ch.qos.logback.classic.Logger) LoggerFactory
.getLogger("de.eidottermihi.rpicheck");
rpicheckLogger.setLevel(isDebugLogging ? Level.DEBUG : Level.INFO);
ch.qos.logback.classic.Logger sshjLogger = (ch.qos.logback.classic.Logger) LoggerFactory
.getLogger("net.schmizz");
sshjLogger.setLevel(Level.WARN);
// setup FileAppender
String logPath = getLogfilePath(context);
if (logPath != null) {
FileAppender<ILoggingEvent> fileAppender = new FileAppender<ILoggingEvent>();
fileAppender.setContext(lc);
fileAppender.setFile(logPath);
fileAppender.setEncoder(encoder1);
fileAppender.start();
rpicheckLogger.addAppender(fileAppender);
sshjLogger.addAppender(fileAppender);
}
root.addAppender(logcatAppender);
LOGGER.debug("Logging was configured, debug logging enabled: {}", isDebugLogging);
}
示例12: 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);
}