Search code examples
logginglogcatandroid-logcat

How do I print empty line, delimiter in Log android?


I have lots of log statements in my activity. I use Log.wtf - it only shows my logs and no system logs shown.

This 4 empty lines in Log:

Log.wtf("x", "\n");
        Log.wtf("x", "\n");
        Log.wtf("x", "\n");
        Log.wtf("x", "\n");
        Log.wtf("x", "number of children in answer place1: " + answer_place1.getChildCount());
        Log.wtf("x", "number of children in answer place2: " + answer_place2.getChildCount());

actually produce this not-so-nice log output:

    09-09 02:52:19.066  22622-22622/nis.history_card_game A/x﹕ [ 09-09 02:52:19.066 22622:22622 F/x        ]
    09-09 02:52:19.070  22622-22622/nis.history_card_game A/x﹕ [ 09-09 02:52:19.070 22622:22622 F/x        ]
09-09 02:52:19.066  22622-22622/nis.history_card_game A/x﹕ [ 09-09 02:52:19.066 22622:22622 F/x        ]
09-09 02:52:19.070  22622-22622/nis.history_card_game A/x﹕ [ 09-09 02:52:19.070 22622:22622 F/x        ]

It prints me some info,i.e. only time and no other information, but I want only empty lines, so it is clear when logs from different parts of code, method show up in logcat, I want to delimiter different log output from different methods. Otherwise it is hard for me to read the logs.

This is rather a productivity hack question.


Solution

  • See this thread which is very similar question to yours:

    Android Logcat very strange behavior when getting empty string

    The answer is: blank lines mess up the internals of the logging system so you should not do that.

    -- Chris http://lograbbit.com