Microlog4Android使用
连时铭
2023-12-01
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" />