本文整理汇总了Java中de.mindpipe.android.logging.log4j.LogConfigurator.setFileName方法的典型用法代码示例。如果您正苦于以下问题:Java LogConfigurator.setFileName方法的具体用法?Java LogConfigurator.setFileName怎么用?Java LogConfigurator.setFileName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类de.mindpipe.android.logging.log4j.LogConfigurator
的用法示例。
在下文中一共展示了LogConfigurator.setFileName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configure
import de.mindpipe.android.logging.log4j.LogConfigurator; //导入方法依赖的package包/类
public static void configure(boolean FreezeLogging) {
final LogConfigurator logConfigurator = new LogConfigurator();
logConfigurator.setFilePattern(LOG_LINE_PATTERN);
logConfigurator.setFileName(LOG_FILENAME);
logConfigurator.setRootLevel(FreezeLogging ? Level.OFF : LOG_LEVEL);
logConfigurator.setMaxFileSize(FILE_SIZE);
logConfigurator.setMaxBackupSize(MAX_BACKUP_SIZE);
// Set log level of a specific logger
logConfigurator.setLevel("org.apache", Level.ERROR);
logConfigurator.setResetConfiguration(FreezeLogging);
try {
logConfigurator.configure();
} catch (Exception e){
//log configuration not supported by device
}
}
示例2: getMyLogger
import de.mindpipe.android.logging.log4j.LogConfigurator; //导入方法依赖的package包/类
public static Logger getMyLogger(String className) {
if (MyAccountUtil.isSDCardMounted()) {
System.out.println("SD card has already mounted");
logDir = Environment.getExternalStorageDirectory() + File.separator + "myaccount" + File.separator + "logs";
} else {
System.out.println("SD card hasn't already mounted");
logDir = MainActivity.getBaseDir() + File.separator + "myaccount" + File.separator + "logs";
}
File destDir = new File(logDir);
if (!destDir.exists()) {
Boolean isSuccess = destDir.mkdirs();
if (!isSuccess)
System.out.println("create dir " + destDir + " failed.");
}
if (myLogger == null) {
final LogConfigurator logConfigurator = new LogConfigurator();
logConfigurator.setFileName(logDir + File.separator + "myaccount.log");
// Set the root log level
logConfigurator.setRootLevel(Level.DEBUG);
// Set log level of a specific logger
logConfigurator.setLevel("org.apache", Level.ERROR);
logConfigurator.configure();
//gLogger = Logger.getLogger(this.getClass());
myLogger = Logger.getLogger(className != null ? className : MainActivity.class.getName());
}
return myLogger;
}
示例3: configure
import de.mindpipe.android.logging.log4j.LogConfigurator; //导入方法依赖的package包/类
/**
* Configures log4j to use an Android appender.
*
* @param context
* - the context of the application or service
*/
public static void configure(Context context) {
final LogConfigurator logConfigurator = new LogConfigurator();
String logfilePath = context.getFilesDir() + LOG_FILE;
logConfigurator.setFileName(logfilePath);
logConfigurator.setRootLevel(Level.DEBUG);
// Set log level of a specific logger
logConfigurator.setLevel(LOGGER_NAME, Level.ERROR);
logConfigurator.configure();
}
示例4: configLog
import de.mindpipe.android.logging.log4j.LogConfigurator; //导入方法依赖的package包/类
public void configLog() {
final LogConfigurator logConfigurator = new LogConfigurator();
logConfigurator.setFileName(Environment.getExternalStorageDirectory() + File.separator + "Cookbook_Log4j.log");
// Set the root log level
logConfigurator.setRootLevel(Level.DEBUG);
// Set log level of a specific logger
logConfigurator.setLevel(TAG, Level.ERROR);
logConfigurator.configure();
mLogger = (Logger) Logger.getInstance(Log4jActivity.class);
}
示例5: configure
import de.mindpipe.android.logging.log4j.LogConfigurator; //导入方法依赖的package包/类
/**
* Configures log4j to use an Android appender.
*/
public static void configure() {
final LogConfigurator logConfigurator = new LogConfigurator();
logConfigurator.setFileName(LOG_FILE_PATH);
logConfigurator.setRootLevel(Level.DEBUG);
// Set log level of a specific logger
logConfigurator.setLevel(LOGGER_NAME, Level.ERROR);
logConfigurator.configure();
}
示例6: configure
import de.mindpipe.android.logging.log4j.LogConfigurator; //导入方法依赖的package包/类
public static void configure() {
final LogConfigurator logConfigurator = new LogConfigurator();
logConfigurator.setFileName(Preferences.NW_STATS_FILE);
logConfigurator.setRootLevel(Level.DEBUG);
// Set log level of a specific logger
logConfigurator.setLevel("org.apache", Level.ERROR);
logConfigurator.configure();
}
示例7: configure
import de.mindpipe.android.logging.log4j.LogConfigurator; //导入方法依赖的package包/类
public static void configure() {
final LogConfigurator logConfigurator = new LogConfigurator();
// Date nowtime = new Date();
// String needWriteMessage = myLogSdf.format(nowtime);
//日志文件路径地址:SD卡下myc文件夹log文件夹的test文件
String fileName = Environment.getExternalStorageDirectory()
+ File.separator + "SmartCamera" + File.separator + "log"
+ File.separator + "Server.log";
//设置文件名
logConfigurator.setFileName(fileName);
//设置root日志输出级别 默认为DEBUG
logConfigurator.setRootLevel(Level.DEBUG);
// 设置日志输出级别
logConfigurator.setLevel("org.apache", Level.INFO);
//设置 输出到日志文件的文字格式 默认 %d %-5p [%c{2}]-[%L] %m%n
logConfigurator.setFilePattern("%d %-5p [%c{2}]-[%L] %m%n");
//设置输出到控制台的文字格式 默认%m%n
logConfigurator.setLogCatPattern("%m%n");
//设置总文件大小
// logConfigurator.setMaxFileSize(1024 * 1024 * 5);
// //设置最大产生的文件个数
// logConfigurator.setMaxBackupSize(100);
//设置所有消息是否被立刻输出 默认为true,false 不输出
logConfigurator.setImmediateFlush(true);
//是否本地控制台打印输出 默认为true ,false不输出
logConfigurator.setUseLogCatAppender(true);
//设置是否启用文件附加,默认为true。false为覆盖文件
logConfigurator.setUseFileAppender(true);
//设置是否重置配置文件,默认为true
logConfigurator.setResetConfiguration(true);
//是否显示内部初始化日志,默认为false
logConfigurator.setInternalDebugging(false);
logConfigurator.configure();
}
示例8: configure
import de.mindpipe.android.logging.log4j.LogConfigurator; //导入方法依赖的package包/类
public static void configure() {
final LogConfigurator logConfigurator = new LogConfigurator();
logConfigurator
.setFileName(Environment.getExternalStorageDirectory() + File.separator + "SdsBasicDemo.log");
logConfigurator.setRootLevel(Level.INFO);
logConfigurator.configure();
}
示例9: configure
import de.mindpipe.android.logging.log4j.LogConfigurator; //导入方法依赖的package包/类
public static void configure(Context context) {
final LogConfigurator logConfigurator = new LogConfigurator();
logConfigurator
.setLogCatPattern("%d{yyyy-MM-dd HH:mm:ss.SSS} %p:%r:%c:%m%n");
logConfigurator.setRootLevel(Level.DEBUG);
// logConfigurator.setUseFileAppender(false);
// logConfigurator.setUseLogCatAppender(false);
File logFileDir = context.getExternalFilesDir(null);
String logFilePath = new File(logFileDir, "myapp.log")
.getAbsolutePath();
logConfigurator.setFileName(logFilePath);
logConfigurator.configure();
}
开发者ID:android-opensource-library-56,项目名称:android-opensource-library-56,代码行数:16,代码来源:ConfigureLog4j.java
示例10: configure
import de.mindpipe.android.logging.log4j.LogConfigurator; //导入方法依赖的package包/类
private static void configure() {
LogConfigurator conf = new LogConfigurator();
conf.setFileName(Environment.getExternalStorageDirectory()
+ File.separator + "lifx-tasker.log");
conf.setRootLevel(Level.DEBUG);
conf.setUseFileAppender(true);
conf.setUseLogCatAppender(false);
conf.configure();
}