follow Mac convention for log files location

This commit is contained in:
Dmitry Jemerov
2009-09-23 15:47:32 +04:00
parent 5ea0084b45
commit a0b6343fca
5 changed files with 23 additions and 5 deletions
+2 -2
View File
@@ -37,7 +37,7 @@
<appender name="FILE" class="org.apache.log4j.RollingFileAppender">
<param name="MaxFileSize" value="1Mb"/>
<param name="MaxBackupIndex" value="12"/>
<param name="file" value="$SYSTEM_DIR$/$LOG_DIR$/idea.log"/>
<param name="file" value="$LOG_DIR$/idea.log"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d [%7r] %6p - %30.30c - %m \n"/>
</layout>
@@ -46,7 +46,7 @@
<appender name="INCOMING_CHANGES_FILE" class="org.apache.log4j.RollingFileAppender">
<param name="MaxFileSize" value="1Mb"/>
<param name="MaxBackupIndex" value="12"/>
<param name="file" value="$SYSTEM_DIR$/$LOG_DIR$/incoming.log"/>
<param name="file" value="$LOG_DIR$/incoming.log"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d [%7r] %6p - %30.30c - %m \n"/>
</layout>
+2
View File
@@ -75,6 +75,8 @@
<string>~/Library/Caches/@@system_selector@@/</string>
<key>idea.plugins.path</key>
<string>~/Library/Application Support/@@system_selector@@/</string>
<key>idea.log.path</key>
<string>~/Library/Logs/@@system_selector@@/</string>
<key>java.endorsed.dirs</key>
<string></string>
<key>idea.smooth.progress</key>
@@ -64,13 +64,13 @@ public class LoggerFactory implements Logger.Factory {
String text = new String(FileUtil.loadFileText(logXmlFile));
text = StringUtil.replace(text, SYSTEM_MACRO, StringUtil.replace(PathManager.getSystemPath(), "\\", "\\\\"));
text = StringUtil.replace(text, APPLICATION_MACRO, StringUtil.replace(PathManager.getHomePath(), "\\", "\\\\"));
text = StringUtil.replace(text, LOGDIR_MACRO, StringUtil.replace(LOG_DIR, "\\", "\\\\"));
text = StringUtil.replace(text, LOGDIR_MACRO, StringUtil.replace(PathManager.getLogPath(), "\\", "\\\\"));
if ("true".equals(System.getProperty("idea.test.test_mode"))) {
text = commentTestModeLines(text);
}
File file = new File(new File(PathManager.getSystemPath()), LOG_DIR);
File file = new File(PathManager.getLogPath());
file.mkdirs();
new DOMConfigurator().doConfigure(new StringReader(text), LogManager.getLoggerRepository());
@@ -62,7 +62,7 @@ public class SocketLock {
if (StartupUtil.isHeadless()) { //team server inspections
throw new RuntimeException("Only one instance of " + productName + " can be run at a time.");
}
@NonNls final String pathToLogFile = PathManager.getSystemPath() + "/log/idea.log file".replace('/', File.separatorChar);
@NonNls final String pathToLogFile = PathManager.getLogPath() + "/idea.log file".replace('/', File.separatorChar);
JOptionPane.showMessageDialog(
JOptionPane.getRootFrame(),
CommonBundle.message("cannot.start.other.instance.is.running.error.message", productName, pathToLogFile),
@@ -38,11 +38,13 @@ public class PathManager {
@NonNls private static final String PROPERTY_CONFIG_PATH = "idea.config.path";
@NonNls private static final String PROPERTY_PLUGINS_PATH = "idea.plugins.path";
@NonNls private static final String PROPERTY_HOME_PATH = "idea.home.path";
@NonNls private static final String PROPERTY_LOG_PATH = "idea.log.path";
@NonNls private static String ourHomePath;
@NonNls private static String ourSystemPath;
@NonNls private static String ourConfigPath;
@NonNls private static String ourPluginsPath;
@NonNls private static String ourLogPath;
@NonNls private static final String FILE = "file";
@NonNls private static final String JAR = "jar";
@@ -52,6 +54,7 @@ public class PathManager {
@NonNls private static final String LIB_FOLDER = "lib";
@NonNls public static final String PLUGINS_DIRECTORY = "plugins";
@NonNls private static final String BIN_FOLDER = "bin";
@NonNls private static final String LOG_DIRECTORY = "log";
@NonNls private static final String OPTIONS_FOLDER = "options";
public static String getHomePath() {
@@ -206,6 +209,19 @@ public class PathManager {
return ourPluginsPath;
}
public static String getLogPath() {
if (ourLogPath == null) {
if (System.getProperty(PROPERTY_LOG_PATH) != null) {
ourLogPath = getAbsolutePath(trimPathQuotes(System.getProperty(PROPERTY_LOG_PATH)));
}
else {
ourLogPath = getSystemPath() + File.separatorChar + LOG_DIRECTORY;
}
}
return ourLogPath;
}
private static String getAbsolutePath(String path) {
if (path.startsWith("~/") || path.startsWith("~\\")) {
path = SystemProperties.getUserHome() + path.substring(1);