0

In Android application I am writing logs to external file and sending this file if any issue raise by customer for reference to analyse the issue it was working fine, but recently it started stripping off debug or warning or verbose logs and keeping only error logs

code for writing logs to external file

File filePath = new File(getApplicationContext().getExternalFilesDir(null), fileName);
if (filePath.exists()) {
    long logcatFileSize = filePath.length() / 1024;
    if (renameFile || logcatFileSize >= AppConfiguration.MAX_ALLOWED_ATTACHMENT_SIZE_NEW) {
        renameCurrentLogFileToBackup(filePath);
        filePath = new File(getApplicationContext().getExternalFilesDir(null), fileName);
    }
}
else
{
    filePath.createNewFile();
}
Runtime.getRuntime().exec("logcat -v threadtime -f " + filePath.getAbsolutePath());

Analysed checking proguard and build file, could not find any clue.

James Z
  • 12,209
  • 10
  • 24
  • 44
Prakash
  • 149
  • 7
  • 2
    did you see this https://stackoverflow.com/questions/25610936/enable-logcat-on-release-build-in-android-studio – Akash Pal Aug 05 '21 at 10:30

1 Answers1

0

You can use Firebase Crashlytics to achieve logging in production.

Kamal Nayan
  • 1,635
  • 1
  • 5
  • 19