[Solved] Writing to Android logfile. lazarus / 43-Android ---------------------------------------------------------------------- iru · 2022-08-04 07:15 Environment Win10, Laz 2012, fpc 3.20 Laz4Android2.0.12. All works OK. Gentlefolk, How do I write to the Android log file in the JNI application????? I have a nasty bug/bad-code/? problem addressing a variable length array and writing some log file entries would be a great help. Ian. ---------------------------------------------------------------------- DonAlfredo · 2022-08-04 09:06 You might add this into your code. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$ifdef Android}const      ANDROID_LOG_UNKNOWN=0;      ANDROID_LOG_DEFAULT=1;      ANDROID_LOG_VERBOSE=2;      ANDROID_LOG_DEBUG=3;      ANDROID_LOG_INFO=4;      ANDROID_LOG_WARN=5;      ANDROID_LOG_ERROR=6;      ANDROID_LOG_FATAL=7;      ANDROID_LOG_SILENT=8; function __android_log_write(prio:cint;tag,text:PAnsiChar):cint; cdecl; external 'liblog.so' name '__android_log_write';{$endif}In your code, use: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure ShowLogMessage(value:ansistring);begin  {$ifdef Android}  __android_log_write(ANDROID_LOG_INFO,'my app logger',pansichar(value));  {$else}    {$ifndef LCL}    writeln('my app logger: '+value);    {$endif}  {$endif}end; ---------------------------------------------------------------------- iru · 2022-08-05 06:32 Thank you, I will give it a try in the next couple of days. Ian ---------------------------------------------------------------------- iru · 2022-08-05 09:45 Add a 'cTypes' to the 'uses' statement and the program compiles correctly. Writes to the log file. Now I just have to decipher the results..... Thank you DonAlfredo you have saved me a lot of time and effort. Ian