Avoid to copy multiple times the temp log file.
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/DataArea.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/DataArea.java index 51f9ffb..b33faf3 100644 --- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/DataArea.java +++ b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/DataArea.java
@@ -79,8 +79,10 @@ if (!isInstanceDataLocationInitiliazed()) { return getTemporaryLogLocation(); } - if (tmpLog != null) + if (tmpLog != null) { copyOldLog(getTemporaryLogLocation(), getMetadataLocation().append(F_LOG)); + tmpLog = null; + } return getMetadataLocation().append(F_LOG); } protected IPath getTemporaryLogLocation() {
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/InternalPlatform.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/InternalPlatform.java index 669934e..b60f4e0 100644 --- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/InternalPlatform.java +++ b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/InternalPlatform.java
@@ -471,7 +471,7 @@ options = (DebugOptions) debugTracker.getService(); //TODO This is not good, but is avoids problems initializeDebugFlags(); initialized = true; - platformLog = new PlatformLogWriter(getMetaArea().getLogLocation().toFile()); + platformLog = new PlatformLogWriter(); addLogListener(platformLog); if ("true".equals(System.getProperty("eclipse.consoleLog"))) { consoleLog = new PlatformLogWriter(System.out);
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformLogWriter.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformLogWriter.java index c8189d1..234cca6 100644 --- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformLogWriter.java +++ b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/PlatformLogWriter.java
@@ -40,8 +40,7 @@ LINE_SEPARATOR = s == null ? "\n" : s; //$NON-NLS-1$ } - public PlatformLogWriter(File file) { - this.logFile = file; + public PlatformLogWriter() { } /** * This constructor should only be used to pass System.out . @@ -64,8 +63,8 @@ */ public synchronized void logging(IStatus status, String plugin) { // thread safety: (Concurrency003) - if (logFile != null) - openLogFile(); + setLogFileLocation(); + openLogFile(); if (log == null) log = logForStream(System.err); try { @@ -92,8 +91,12 @@ } } finally { log = null; + logFile = null; } } + protected void setLogFileLocation() { + logFile = InternalPlatform.getDefault().getMetaArea().getLogLocation().toFile(); + } protected void openLogFile() { try { log = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(logFile.getAbsolutePath(), true), "UTF-8")); //$NON-NLS-1$