diff --git a/docs/en_US/release_notes_4_24.rst b/docs/en_US/release_notes_4_24.rst index bec5cb8d1..3995cbc2c 100644 --- a/docs/en_US/release_notes_4_24.rst +++ b/docs/en_US/release_notes_4_24.rst @@ -27,6 +27,7 @@ Bug fixes | `Issue #3851 `_ - Add proper indentation to the code while generating functions, procedures, and trigger functions. | `Issue #4235 `_ - Fixed tab indent issue on a selection of lines is deleting the content when 'use spaces == true' in the preferences. | `Issue #5287 `_ - Fixed dark theme-related CSS and modify the color codes. +| `Issue #5414 `_ - Use QStandardPaths::AppLocalDataLocation in the runtime to determine where to store runtime logs. | `Issue #5463 `_ - Fixed an issue where CSV download quotes numeric columns. | `Issue #5470 `_ - Fixed backgrid row hover issue where on hover background color is set for edit and delete cell only. | `Issue #5530 `_ - Ensure that the referenced table should be displayed on foreign key constraints. diff --git a/runtime/LogWindow.cpp b/runtime/LogWindow.cpp index c9d5eb736..a4e678469 100644 --- a/runtime/LogWindow.cpp +++ b/runtime/LogWindow.cpp @@ -35,9 +35,14 @@ void LogWindow::LoadLog() int startupLines; int serverLines; + QString startup_log = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + (QString("/.%1.startup.log").arg(PGA_APP_NAME)).remove(" "); + ui->lblStatus->setText(tr("Loading logfiles...")); - startupLines = this->readLog(QDir::homePath() + (QString("/.%1.startup.log").arg(PGA_APP_NAME)).remove(" "), ui->textStartupLog); + ui->lblStartupLog->setText(tr("Startup Log (%1):").arg(startup_log)); + ui->lblServerLog->setText(tr("Server Log (%1):").arg(m_serverLogFile)); + + startupLines = this->readLog(startup_log, ui->textStartupLog); serverLines = this->readLog(m_serverLogFile, ui->textServerLog); ui->lblStatus->setText(QString(tr("Loaded startup log (%1 lines) and server log (%2 lines).")).arg(startupLines).arg(serverLines)); diff --git a/runtime/Logger.cpp b/runtime/Logger.cpp index acd9f5dcb..73f54197e 100644 --- a/runtime/Logger.cpp +++ b/runtime/Logger.cpp @@ -27,7 +27,7 @@ Logger* Logger::GetLogger() if (m_pThis == Q_NULLPTR) { m_pThis = new Logger(); - m_sFileName = QDir::homePath() + (QString("/.%1.startup.log").arg(PGA_APP_NAME)).remove(" "); + m_sFileName = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + (QString("/.%1.startup.log").arg(PGA_APP_NAME)).remove(" "); m_Logfile = new QFile; m_Logfile->setFileName(m_sFileName); m_Logfile->open(QIODevice::WriteOnly | QIODevice::Text); diff --git a/runtime/pgAdmin4.cpp b/runtime/pgAdmin4.cpp index b8a18ec7f..05c3b7287 100644 --- a/runtime/pgAdmin4.cpp +++ b/runtime/pgAdmin4.cpp @@ -109,11 +109,12 @@ int main(int argc, char * argv[]) #endif // Create a hash of the executable path so we can run copies side-by-side - QString homeDir = QDir::homePath(); unsigned long exeHash = sdbm(reinterpret_cast(argv[0])); // Create the address file, that will be used to store the appserver URL for this instance - addrFileName = homeDir + (QString("/.%1.%2.addr").arg(PGA_APP_NAME).arg(exeHash)).remove(" "); + QDir workdir; + workdir.mkpath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation)); + addrFileName = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + (QString("/.%1.%2.addr").arg(PGA_APP_NAME).arg(exeHash)).remove(" "); QFile addrFile(addrFileName); // Create a system-wide semaphore keyed by app name, exe hash and the username @@ -250,7 +251,7 @@ int main(int argc, char * argv[]) key = key.mid(1, key.length() - 2); // Generate the filename for the log - logFileName = homeDir + (QString("/.%1.%2.log").arg(PGA_APP_NAME).arg(exeHash)).remove(" "); + logFileName = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + (QString("/.%1.%2.log").arg(PGA_APP_NAME).arg(exeHash)).remove(" "); // Create Menu Actions MenuActions *menuActions = new MenuActions();