Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

How do I increase the size of dev/log/main by a factor of 10? My understanding is the log has a fixed size (16K?) and rolls over when that limit is reached. I'd like to find out what the log size is currently set at and increase it by a lot.

I'm debugging an issue that occurs infrequently when the device hasn't been used for a long period of time (maybe an hour?). I've instrumented the code with log messages so I can understand what is happening when the bug occurs.

My problem is my instrumentation causes the log to roll over in about 2 minutes. I would like to increase the size of dev/log/main by a factor of 10 if possible.

share|improve this question
    
I presume that leaving it connected to the computer with adb logcat > my_log_file.log running isn't an option? –  Kevin M Dec 29 '11 at 22:00
add comment

2 Answers 2

up vote 3 down vote accepted

To find out the actual size of the ring buffer, you can use

$ adb logcat -g

To adjust the size of the ring buffer, you might try

$ adb logcat -r <kbytes>

At least that's what some tutorials say. For more details, you might want to read "adb logcat" Command Options and Log Buffers.

P.S.: I guess those settings (manual adjusted ring buffer size) will not survive a reboot -- just to consider.

share|improve this answer
    
actually it needs tp be adb logcat -r 100000 -f sdcard/log.log . -f is required. –  Aftershock Sep 13 '13 at 18:39
    
I dont think -r is useful as from reading the logcat manual, it will set the size at which the logcat tool will rotate the file it is writing out to using the "-f" option and NOT the size of the in-memory ring buffer used by the logger kernel module! –  Maks Feb 25 at 2:59
add comment

If you're looking to change the default size for a log buffer, to persist between reboots, you can recompile the kernel with updated buffer sizes.

The file containing log buffer definitions is:

<kernel>/drivers/staging/android/logger.c

The versions I'm looking at use a macro to define log buffers in that file:

DEFINE_LOGGER_DEVICE(variable, name, size)

There will likely be a number of loggers; "main" is usually the one you're looking for.

share|improve this answer
    
This should be known on all the related questions here and on stackoverflow ! Nice find. Of note, Main and System are the default logcat buffers. You'd probably want to increase them both. Well, depending on if your Android version uses them. See logcat -g and logcat -h –  cde Jan 12 at 9:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.