最近有这么一个需求,就是把android系统或应用程序里面的log进行本地化,既把日志信息保存在文件里面存储到终端上面或SDCard存储介质里面,日志文件到达一定的大小后要进行切割分存,整个日志文件存储大小过拉指定大小后要把最旧的日志文件进行删除,我知道日志本不应该这样处理的,但需求是这样的,没办法,整了两天也没有整出个啥东西出来,看了slf4j-android组件,但该组件貌似不能实现此功能,它只能把android本身的日志做了一个转换然后打印到客户端,也就是说只做显示,它也没有提供像log4j那样的属性配置文件进行配置信息。在网络也没有找到什么解决方案,这个问题很棘手,还请各位帮忙,谢谢。
解决方案 »
- jni显示surface的问题
- 新安装的应用为什么桌面图标没有被替换?
- 尖括号是什么意思?
- android socket通信,byte数组发送不出去
- 反编译apk
- Activity显示的时候,自动弹出软键盘,请问如何防止
- 关于eclipse下开发android,弹出成员函数是暴卡的问题,原来是ADT的问题!
- error: Error retrieving parent for item: No resource found that matches
- Android 自定义surfaceview作为背景
- 实现出厂设置 如何跳过 设备管理器激活 这一步
- android手机锁屏了gprs会断开么?
- android 获取不了本机手机号?
http://developer.android.com/tools/help/logcat.html
Option Description
-b <buffer> Loads an alternate log buffer for viewing, such as event or radio. The main buffer is used by default. See Viewing Alternative Log Buffers.
-c Clears (flushes) the entire log and exits.
-d Dumps the log to the screen and exits.
-f <filename> Writes log message output to <filename>. The default is stdout.
-g Prints the size of the specified log buffer and exits.
-n <count> Sets the maximum number of rotated logs to <count>. The default value is 4. Requires the -r option.
-r <kbytes> Rotates the log file every <kbytes> of output. The default value is 16. Requires the -f option.
-s Sets the default filter spec to silent.
-v <format> Sets the output format for log messages. The default is brief format. For a list of supported formats, see Controlling Log Output Format.