Support #1709

log file of ctlike

Added by Dang Viet Tan about 8 years ago. Updated about 8 years ago.

Status:ClosedStart date:02/24/2016
Priority:NormalDue date:
Assigned To:Knödlseder Jürgen% Done:

100%

Category:-
Target version:-
Duration:

Description

Dear the system admin

Hi, my name is Tan.
I found that the log file cannot be opened by the following python code.

...
logfile=“ctlike_"+str(ibin)+".log”
ctl = ctlike()
ctl.logFileOpen(logfile)
...

This code worked with the old ctools version. Maybe this is a bug (or an intentional change?). Can you change it work

Thank you for reading me.
Tan


Recurrence

No recurrence.

History

#1 Updated by Knödlseder Jürgen about 8 years ago

  • Tracker changed from Bug to Support
  • Status changed from New to Feedback
  • Assigned To set to Knödlseder Jürgen
  • % Done changed from 0 to 100

I inspected the change log and could not find any moment where the logFileOpen() method accepted a filename (you can pass a Boolean parameter to specify whether a new log file should be written, logFileOpen(True), or whether the the logger should append to an existing log file, logFileOpen(False); maybe you passed the logfile as Boolean parameter).

The correct way to do what you want is setting the logfile parameter before opening the log file, i.e.

logfile = "ctlike_"+str(ibin)+".log" 
ctl = ctlike()
ctl["logfile"] = logfile
ctl.logFileOpen()
Note that logFileOpen() has to be called after ctl["logfile"] since logFileOpen() will open the file and use the value of the logfile parameter that exists at that time.

#2 Updated by Dang Viet Tan about 8 years ago

Thank you. I’ve already checked it.

#3 Updated by Knödlseder Jürgen about 8 years ago

  • Status changed from Feedback to Closed

Also available in: Atom PDF