Android Question B4A: IDE: How to really delete the Logs?

Jehoschua

Member
Licensed User
Good evening

the B4A Logs has a "Clear" button. Unfortunately, it does not clear the log, it's just similar to a "clear screen" in a shell and all the old Logs comes back really fast (e.g. if the App is restarted :-()

Because we're usually not interested in old Logs or exceptions (especially, if we restart the App):
how can we really delete the old Logs?

Thanks a lot for any help!,
kind regards,
Thomas
 

MarkusR

Well-Known Member
Licensed User
the b4a-bridge not have access to this logs?
 
Upvote 0

DonManfred

Expert
Licensed User
Upvote 0

MarkusR

Well-Known Member
Licensed User
Last edited:
Upvote 0

Jehoschua

Member
Licensed User
Thanks a lot for your clarification!,
as it is the Androids local App Logfile, we can easily delete it on each startup (it's probably the same command which other IDEs are using if the 'clear log on startup' configuration flag is set):

B4X:
Sub Activity_Create(FirstTime As Boolean)
    ClearLog
    Log("Start")
End Sub

' Clears the Android's local App Log - and therefore the IDE Log, too
Sub ClearLog()
    Dim PB As JavaObject
    Dim Commands As List: Commands.Initialize
    Commands.Add("logcat")
    Commands.Add("-c")
    PB = PB.InitializeNewInstance("java.lang.ProcessBuilder", Array As Object(Commands))
    PB.RunMethod("redirectErrorStream", Array As Object(True))
    PB.RunMethod("start", Null)
End Sub

The only drawback is, that we have still to click "Clear" in the IDE Log Panel. But it works :)
 
Upvote 0
Top