Logcat b4a code

peacemaker

Expert
Licensed User
Longtime User
Hi, All

Any possibility to built-in the b4a code\module..., where the application is getting system log part (say latest 1000 lines, or seconds...) saving it, and later, after restarting the hunging application, for ex., sending this log by Email intent ?

For remote debugging from customer's side.
Srange situation when you can see via webcam, that application has a error, but here, on my own device - no such problems. Android versions are the same
 

Maartensaps

Member
Licensed User
Longtime User
how to direct logcat info to a txt-file on the phone

I want to put a function inside an app to send the last few (like 10 or 20) seconds of the log to a txt file on the SD-card.

I've been reading dozens of posts about this, but I guess I am a very slow learner.:sign0137:
The answer" "You can do this with the "LogCat" just does not help me.
The documentation also does not make my internal light-bulb go "aha!"

A simple example would be great.:sign0060:
How to switch it on, how to direct it to a file.

Thanks!!!
 
Upvote 0

Maartensaps

Member
Licensed User
Longtime User
eehhhhh?

I recommend you to instead create a MyLog method such as:
B4X:
Public Sub MyLog(s As String)
 Log(s)
 'Write s to file with an open TextWriter
End Sub
.

I feel so dumb...
Where do I put this code ?
does s then contain the system log ?
do I still use " Log("this is a log message") ?

You must think I am so dumb, but I just don't get the hang of the structure of it all.

Thanks for your patience
 
Upvote 0

Maartensaps

Member
Licensed User
Longtime User
But how to get "system messages" in a custom log

Sorry for the confusion. I meant that it will be much easier to create a small utility sub and use it instead of Log.

Hi Erel,
Sorry to keep on bugging you.
I understand what you mean, but how do I get system-messages into a custom log.
For instance, if a function fails, but does not generate a serious error, nothing happens (Like in the case of "no permission to switch on speaker).

That is the kind of messages I am after, remote.

I have been searching all over, but could not find any clues.

I appreciate your patience
Maarten
 
Upvote 0
Top