版本1.3.0:
我的多实例代码:
logPath = getExternalCacheDir().getPath() + "/logsample/xlog";
xlog2 = new Xlog();
xlogInstance2 = xlog2.openLogInstance(Xlog.LEVEL_DEBUG, Xlog.AppednerModeSync, "", logPath, "LOGSAMPLE2", 0);
xlog2.setConsoleLogOpen(xlogInstance2, true);
xlog2.appenderOpen(Xlog.LEVEL_DEBUG, Xlog.AppednerModeSync, "", logPath, "LOGSAMPLE2", 0);
logPath1 = getExternalCacheDir().getPath() + "/logsample/xlog1";
xlog1 = new Xlog();
xlogInstance1 = xlog1.openLogInstance(Xlog.LEVEL_DEBUG, Xlog.AppednerModeSync, "", logPath1, "LOGSAMPLE1", 0);
xlog1.setConsoleLogOpen(xlogInstance1, true);
xlog1.appenderOpen(Xlog.LEVEL_DEBUG, Xlog.AppednerModeSync, "", logPath1, "LOGSAMPLE1", 0);
xlog2.logD(
xlogInstance2,
"testxlog",
logPath,
"111",
2,
android.os.Process.myPid(),
Thread.currentThread().getId(),
Thread.currentThread().getId()
, "aaaaaaaaaaaaaaaaaaaaaaaaaaa22222222222222222"
);
xlog1.logI(
xlogInstance1,
"testxlog1",
logPath1,
"1111",
2,
android.os.Process.myPid(),
Thread.currentThread().getId(),
Thread.currentThread().getId(),
"bbbbbbbbbbbbbbbbbbbbbbbbbbbb1111111111111111111"
);
存在的问题:
1.AppednerModeSync模式下最后一行log无法写入文件;
2.AppednerModeAsync模式下解密报错:
error: Error -3 while decompressing: invalid block type
Traceback (most recent call last):
File "decode_mars_nocrypt_log_file.py", line 124, in DecodeBuffer
tmpbuffer = decompressor.decompress(str(tmpbuffer))
1条答案
按热度按时间dwthyt8l1#
我的解决方法是程序退出时调用 xlog1.releaseXlogInstance("LOGSAMPLE1");方法,可以正常写入最后一个log。