During compile time, could you have the log function prepend the module name and line number to the text being sent?
ie: whatever code you use to convert the B4A code to Java, when it detects the text log followed by any number of whitespace characters, then a "(", but must have been preceeded by either whitespace, a "(", or a ",", it automatically changes it to log(ModuleName & "_" & LineNumber & ": " & TheText)
Maybe add a new compile mode, Semi-debug, and only have it do it in that mode. That way retail mode is untouched
(This is so it'd be easier to track down any logs where you didn't make it easily identifiable)