Forum

Author Topic: Saving log to a specified location with log_path  (Read 91 times)

Dark_Corvid

  • Newbie
  • *
  • Posts: 6
    • View Profile
Saving log to a specified location with log_path
« on: July 11, 2019, 05:30:11 AM »
In my script, I enabled the log with
Code: [Select]
Metashape.Application.Settings(log_enable=True) This generates a log file as expected.

However, when I try to set the log to a save location as specified in the API
Code: [Select]
Metashape.Application.Settings(log_path="C:/somelocation") the log is not saved where specified.

Any help would be appreciated.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 10440
    • View Profile
Re: Saving log to a specified location with log_path
« Reply #1 on: July 11, 2019, 11:12:07 AM »
Hello Dark_Corvid,

Please try the following:

Code: [Select]
Metashape.app.settings.log_path = "C:/somelocation/log.txt"
Best regards,
Alexey Pasumansky,
AgiSoft LLC

Dark_Corvid

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Saving log to a specified location with log_path
« Reply #2 on: July 11, 2019, 10:44:21 PM »
I did as you suggested but found I had to also change
Code: [Select]
Metashape.Application.Settings(log_enable=True) to
Code: [Select]
Metashape.app.settings.log_enable = True then it all worked.

Thank you!

Christina K

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Saving log to a specified location with log_path
« Reply #3 on: July 18, 2019, 02:46:49 PM »
We are running Metashape from Python in the background without any visual console or information. Consequently, I would like to enable the logging, to be able to see what happened if something went wrong.

I currently have this lines (as suggested in the previous posts) right after importing Metashape.

Code: [Select]
Metashape.app.settings.log_enable = True
# Metashape.Application.Settings(log_enable=True)
# Run specific
Metashape.app.settings.log_path = os.path.join(work_dir, "console_log.txt")


But the log is not saved. Both variations of log_enable do not work and I am out of ideas.

The line where we define the log_path seems to work because when I open metashape and go to preferences I can see the correct path. The box "write to log" is also checked. When running a project in the normal GUI the log is saved to the correct location. It just does not seem to work from Python.

Thanks in advance!