Question: I would like to be able to save and print logcat messages when my device is disconnected from the computer, and then when I plug it in, to have all the messages be printed to logcat.

Currently, when I log, this does not happen. When I plug my phone in, I can hook the device to logcat and lots of logs from the day get printed into logcat. They are listed under my app's process. My logs are not there though. How can I get them there?

Here is how I log:

```
    public static final String TAG = "Service";
    Log.v(TAG, "log");

```

Edit: Yesterday, I disconnected from logcat with a process running. Then today, I reconnected to logcat. Since I still had a filter for my logs on, logs from the last few hours printed. I then turned the filter on and off and all of them disappeared.

Answer: 
You need to build a class that will be a wrapper for the `android.util.Log` class, that redirects the output to both file and console. Check [this answer](https://stackoverflow.com/a/10102176/12502168), it is a bit outdated but you can still follow the example and build such a class. This way you get the logs written to a file that you can check whenever you want.
You may save your logs to sharedpreferences and get it value after connection