log console to file?

Feel free to ask any question here
Post Reply
ashenkin
Posts: 11
Joined: Thu May 25, 2017 3:29 pm

log console to file?

Post by ashenkin »

Hi there,

Is there any way to set up CC to log the console output to a file? This is especially important in case CC crashes and i've done work i don't want to lose (in my case, recording transformation matrices is important). Yes, I can copy and paste manually, but if i forget sometimes, etc...

thanks,
allie
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: log console to file?

Post by daniel »

There's only the '-LOG_FILE' option, would it work for you? (http://www.cloudcompare.org/doc/wiki/in ... _line_mode)

(and if CC crashes, just tell us ;)
Daniel, CloudCompare admin
ashenkin
Posts: 11
Joined: Thu May 25, 2017 3:29 pm

Re: log console to file?

Post by ashenkin »

Thanks Daniel - any way to run the full GUI with the logfile option turned on? cloudcompare -LOG_FILE "temp.txt" just runs the cli and then closes...
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: log console to file?

Post by daniel »

Oh sorry I misunderstood. Then no, this option is not available with the GUI version.
Daniel, CloudCompare admin
ashenkin
Posts: 11
Joined: Thu May 25, 2017 3:29 pm

Re: log console to file?

Post by ashenkin »

ok, thanks daniel.
mdf_anas
Posts: 1
Joined: Mon Sep 18, 2023 9:27 am

Re: log console to file?

Post by mdf_anas »

In mainwindow.cpp MainWindow::MainWindow(),add follow code.

Code: Select all

//Console
ccConsole::Init(m_UI->consoleWidget, this, this);
m_UI->actionEnableQtWarnings->setChecked(ccConsole::QtMessagesEnabled());
QString applicationPath = QApplication::applicationDirPath();
QString logDirPath = applicationPath + "/logs/";
QDir logPathDir(logDirPath);
if (!logPathDir.exists())
{
    logPathDir.mkpath(logDirPath);
}
QString currentDateTime = QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss");
QString logPath = logDirPath + currentDateTime + ".log";
ccConsole* consoleObj = ccConsole::TheInstance(false);
consoleObj->setLogFile(logPath);
Post Reply