首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

Microlog4Android运用

2012-07-04 
Microlog4Android使用1. Add the following static variable in your main Activity:private static final

Microlog4Android使用
1. Add the following static variable in your main Activity:

private static final Logger logger = LoggerFactory.getLogger();

2. Add the following to your onCreate() method:

PropertyConfigurator.getConfigurator(this).configure();

3. Create a file named microlog.properties and store it in /assets

4. Edit the microlog.properties file as follows:

microlog.level=DEBUG
microlog.appender=LogCatAppender;FileAppender
microlog.formatter=PatternFormatter
microlog.formatter.PatternFormatter.pattern=%c [%P] %m %T

5. Add logging statements like this:

logger.debug("M4A");

Note:
AndroidManifest.xml
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

热点排行