From 45650d2307bd512a4896d532cc91a5a6a9fd6206 Mon Sep 17 00:00:00 2001 From: Bartosz Przybylski Date: Sat, 21 Nov 2015 17:22:12 +0100 Subject: [PATCH] Sychronize methods for logging starting and stopping. First of, this will prevent logs mixing, sencondly this will allow user to safely migrate data even when other thread will call logging functions --- src/com/owncloud/android/lib/common/utils/Log_OC.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/com/owncloud/android/lib/common/utils/Log_OC.java b/src/com/owncloud/android/lib/common/utils/Log_OC.java index 5aa85cc1..9670061f 100644 --- a/src/com/owncloud/android/lib/common/utils/Log_OC.java +++ b/src/com/owncloud/android/lib/common/utils/Log_OC.java @@ -73,7 +73,7 @@ public class Log_OC { * Start doing logging * @param storagePath : directory for keeping logs */ - public static void startLogging(String storagePath) { + synchronized public static void startLogging(String storagePath) { String logPath = storagePath + File.separator + mOwncloudDataFolderLog + File.separator + LOG_FOLDER_NAME; mFolder = new File(logPath); @@ -111,7 +111,7 @@ public class Log_OC { } } - public static void stopLogging() { + synchronized public static void stopLogging() { try { if (mBuf != null) mBuf.close(); @@ -164,7 +164,7 @@ public class Log_OC { * Append to the log file the info passed * @param text : text for adding to the log file */ - private static void appendLog(String text) { + synchronized private static void appendLog(String text) { if (isEnabled) {