当前位置: 代码迷 >> Android >> Microlog4Android运用
  详细解决方案

Microlog4Android运用

热度:84   发布时间:2016-05-01 19:17:41.0
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" />

  相关解决方案