1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-07 16:06:08 +00:00

Stop logging in exception free way

This commit is contained in:
Bartosz Przybylski 2015-11-21 13:03:55 +01:00 committed by David A. Velasco
parent 9cbf572510
commit 080b3f56fc

View File

@ -113,7 +113,8 @@ public class Log_OC {
public static void stopLogging() {
try {
mBuf.close();
if (mBuf != null)
mBuf.close();
isEnabled = false;
mLogFile = null;
@ -123,7 +124,13 @@ public class Log_OC {
isEnabled = false;
} catch (IOException e) {
e.printStackTrace();
// Because we are stopping logging, we only lon to Android console.
Log.e("OC_Log", "Closing log file failed: ", e);
} catch (Exception e) {
// This catch should never fire because we do null check on mBuf.
// But just for the sake of stability let's log this odd situation.
// Because we are stopping logging, we only lon to Android console.
Log.e("OC_Log", "Stopping logging failed: ", e);
}
}