use of org.jkiss.dbeaver.utils.SystemVariablesResolver in project dbeaver by dbeaver.
the class DBeaverApplication method initDebugWriter.
private void initDebugWriter() {
DBPPreferenceStore preferenceStore = DBeaverCore.getGlobalPreferenceStore();
if (!preferenceStore.getBoolean(DBeaverPreferences.LOGS_DEBUG_ENABLED)) {
return;
}
String logLocation = preferenceStore.getString(DBeaverPreferences.LOGS_DEBUG_LOCATION);
if (CommonUtils.isEmpty(logLocation)) {
// $NON-NLS-1$
logLocation = new File(GeneralUtils.getMetadataFolder(), "dbeaver-debug.log").getAbsolutePath();
}
logLocation = GeneralUtils.replaceVariables(logLocation, new SystemVariablesResolver());
File debugLogFile = new File(logLocation);
if (debugLogFile.exists()) {
if (!debugLogFile.delete()) {
// $NON-NLS-1$
System.err.println("Can't delete debug log file");
return;
}
}
try {
debugWriter = new FileOutputStream(debugLogFile);
oldSystemOut = System.out;
oldSystemErr = System.err;
System.setOut(new PrintStream(new ProxyPrintStream(debugWriter, oldSystemOut)));
System.setErr(new PrintStream(new ProxyPrintStream(debugWriter, oldSystemErr)));
} catch (IOException e) {
e.printStackTrace(System.err);
}
}
use of org.jkiss.dbeaver.utils.SystemVariablesResolver in project dbeaver by serge-rider.
the class DBeaverApplication method initDebugWriter.
private void initDebugWriter() {
DBPPreferenceStore preferenceStore = DBWorkbench.getPlatform().getPreferenceStore();
if (!preferenceStore.getBoolean(DBeaverPreferences.LOGS_DEBUG_ENABLED)) {
return;
}
String logLocation = preferenceStore.getString(DBeaverPreferences.LOGS_DEBUG_LOCATION);
if (CommonUtils.isEmpty(logLocation)) {
// $NON-NLS-1$
logLocation = new File(GeneralUtils.getMetadataFolder(), DBConstants.DEBUG_LOG_FILE_NAME).getAbsolutePath();
}
logLocation = GeneralUtils.replaceVariables(logLocation, new SystemVariablesResolver());
File debugLogFile = new File(logLocation);
if (debugLogFile.exists()) {
if (!debugLogFile.delete()) {
// $NON-NLS-1$
System.err.println("Can't delete debug log file");
return;
}
}
try {
debugWriter = new FileOutputStream(debugLogFile);
oldSystemOut = System.out;
oldSystemErr = System.err;
System.setOut(new PrintStream(new ProxyPrintStream(debugWriter, oldSystemOut)));
System.setErr(new PrintStream(new ProxyPrintStream(debugWriter, oldSystemErr)));
} catch (IOException e) {
e.printStackTrace(System.err);
}
}
use of org.jkiss.dbeaver.utils.SystemVariablesResolver in project dbeaver by dbeaver.
the class DBeaverApplication method initDebugWriter.
private void initDebugWriter() {
DBPPreferenceStore preferenceStore = DBWorkbench.getPlatform().getPreferenceStore();
if (!preferenceStore.getBoolean(DBeaverPreferences.LOGS_DEBUG_ENABLED)) {
return;
}
String logLocation = preferenceStore.getString(DBeaverPreferences.LOGS_DEBUG_LOCATION);
if (CommonUtils.isEmpty(logLocation)) {
// $NON-NLS-1$
logLocation = new File(GeneralUtils.getMetadataFolder(), DBConstants.DEBUG_LOG_FILE_NAME).getAbsolutePath();
}
logLocation = GeneralUtils.replaceVariables(logLocation, new SystemVariablesResolver());
File debugLogFile = new File(logLocation);
if (debugLogFile.exists()) {
if (!debugLogFile.delete()) {
// $NON-NLS-1$
System.err.println("Can't delete debug log file");
return;
}
}
try {
debugWriter = new FileOutputStream(debugLogFile);
oldSystemOut = System.out;
oldSystemErr = System.err;
System.setOut(new PrintStream(new ProxyPrintStream(debugWriter, oldSystemOut)));
System.setErr(new PrintStream(new ProxyPrintStream(debugWriter, oldSystemErr)));
} catch (IOException e) {
e.printStackTrace(System.err);
}
}
Aggregations