zackzhengzx / alogcat

Automatically exported from code.google.com/p/alogcat
0 stars 0 forks source link

Auto-save duplicates log entries #27

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.Enable hourly auto-log
2.Log something
3.Watch the timestamps in the logs written. Some lines, already appearing in a 
previous log, are replicated in the next

What is the expected output? What do you see instead?
No replication, next log should start with the next line following the line 
written in the previous log

What version of the product are you using? On what operating system?
lates

Please provide any additional information below.

Original issue reported on code.google.com by decades-...@freenet.de on 16 Apr 2011 at 3:35

GoogleCodeExporter commented 8 years ago
I've faced this problem too.
As Android only savs 64kb logs of the system.
if the interval is so short,there should be duplicates logs,
while some logs missed if the interval is too long.
I first used a command "logcat -c" to clear the buffer after every
command of fetching logs which had a short interval,
but it didn't work.In my opinion,it's because of the permission,
because it works on adb.
and then a got another solution:save the last log's time tag of the
latest saved logs,and filter current logs by the time.

Original comment by qion...@gmail.com on 10 Jul 2011 at 6:29

GoogleCodeExporter commented 8 years ago
for power consumption reasons, the og save feature isn't sitting in the 
background reading the log and keeping a bufffer. it works by waking up every 
so often and recording a snapshot of the log.

to avoid duplicates, it would need to look at existing log entries, by 
re-reading the file, and find the last written log entry. to do this, it would 
need to parse every log entry line to extract the time. 

the other option would be to keep a process running, always, in the background 
that is recording every log entry and copying it into the file.

neither of these options is nice on the battery. perhaps there's a better way, 
but it's not obvious to me at this time.

Original comment by jeffrey.blattman@gmail.com on 13 Jul 2011 at 3:59