12

Hi Android Developers!

I am trying to figure out what -r and -n parameters for logcat utilitiy mean. When my log file exceeds -r number of kilobytes in size; it deletes the whole content of my log file which leaves it empty or creates a new file to continue with the logging process? What exactly does -n mean as well, ofc?

Thanks for your replies in advance, Ilker

iliTheFallen
  • 466
  • 7
  • 16

2 Answers2

5

enter image description here

Source

So after a file size reaches the limit specified using -r option then new file is created and logs are redirected to that file. Number of such files to be created are specified by -n option. When n count is reached your 1st file will be overwritten.

Aniket Thakur
  • 66,731
  • 38
  • 279
  • 289
2

-n specifies the maximum number of rotated logs
-r specifies the size after which the log file should rotate

See http://developer.android.com/tools/debugging/debugging-log.html for more info.

AesSedai101
  • 1,502
  • 2
  • 23
  • 37
  • 1
    What's the `-r` limit? Apparently it's > the default (16) and less than what I'm specifying (10000). Clearly I can use binary search to determine it myself, but a doc that contains this would probably be useful to know about (haven't found it yet). Note that I use -r and -n, and it works for me. I invoke logCat from my Android app. A useful reference for the code is this Question: http://stackoverflow.com/questions/6219345/android-unable-to-run-logcat-from-application – rich p Oct 18 '14 at 23:10
  • Can you write a command to save logact contents into a file including -r and -n paramaters. – nethra gowda Aug 17 '18 at 13:43