mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Use QStandardPaths::AppLocalDataLocation in the runtime to determine where to store runtime logs. Fixes #5414
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<unsigned char *>(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();
|
||||
|
||||
Reference in New Issue
Block a user