backup-log: use a rename command when make a backup log
authorMinkee Lee <minkee.lee@samsung.com>
Thu, 28 Jan 2016 12:06:18 +0000 (21:06 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Mon, 1 Feb 2016 07:38:52 +0000 (16:38 +0900)
A rename operation takes less time than copy.
(A file copy takes long time if log file is very large
and it causes emulator-manager and emulator start slowly)

Change-Id: Ib60b131df38a6407a4762ea880a4098fd0c73923
Signed-off-by: Minkee Lee <minkee.lee@samsung.com>
src/org/tizen/emulator/manager/vms/helper/VMLogUtil.java

index 5e9a8db..861f254 100644 (file)
@@ -29,7 +29,6 @@
 package org.tizen.emulator.manager.vms.helper;
 
 import java.io.File;
-import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -71,9 +70,11 @@ public class VMLogUtil {
 
                Path target = makeBackupFilePath(source);
                try {
-                       Files.copy(source, target, StandardCopyOption.REPLACE_EXISTING);
-               } catch (IOException e) {
-                       EMLogger.getLogger().warning("Failed to make back log." ); //$NON-NLS-1$
+                       Files.move(source, target, StandardCopyOption.REPLACE_EXISTING);
+               } catch (Exception e) {
+                       EMLogger.getLogger().warning("Failed to make back log. " //$NON-NLS-1$
+                                               + e.getClass().getName() +", "
+                                               + e.getMessage());
                }
        }