I can't seem to find an answer or a question regarding this:
How do I store an Android Log entry to a string:
Log.i(TAG, "onCreate: start: ");
String s = /* get last Log entry */.toString();
The reason for this is so I can have the process ID and thread IDs. When I try to manual store the process and thread IDs, the thread IDs are different than printed in Logcat:
Log.i(TAG, "#checkWifiConnection: start");
String s = Integer.toString(android.os.Process.myPid()) + " " + Integer.toString(android.os.Process.getThreadPriority(android.os.Process.myTid())) + " " + TAG;
System.out.println(s + "#checkWifiConnection: start");
Logcat shows:
01-09 18:38:02.994 1558-2021 I/*~FETCH DATA: #checkWifiConnection: start
System.out shows:
I/System.out: 1558 10 *~FETCH DATA#checkWifiConnection: start
You can not do this.
From
Log documentationThey are only for
Logcatindebugsection, so I recommend you to look for another way to store your desire.For instance you could create a class, that stores all of the
Logyou have, and then store it wherever you want.Then create more attributes for this specific class and pass them whenever you want.
To store the
Process iduseTo store the
Thread iduseTo store the timestamp use