#1
|
|||
|
|||
Default log file name changed after script is ran.
Hello VanDyke team,
I have in the session option the default log file name set as follows "V:\logs\%S_%Y_%M%D.log" but every time I run a script that logs to a specific log file name and closes it, when I open the session again and want to log the work done the default session log file name is changed to the name last used in the script e.g "V:\script_log_date.log", Is there a way to keep the default log file name as specified in the session option after the script is complete "V:\logs\%S_%Y_%M%D.log"? thanks for your support. |
#2
|
|||
|
|||
I think one way to accomplish this is to capture the current name, set new name, start log, reset name.
Code:
# $language = "Python" # $interface = "1.0" s = crt.Session config = s.Config orig_name = config.GetOption("Log Filename") s.LogFileName = "my-new-file.log" s.Log(False) s.Log(True, True) s.LogFileName = orig_name # rest of script / terminal work Note: had to use config.GetOption() to retain the raw "%S_%Y_%M%D" - because s.LogFileName returns the substituted name. Last edited by gregg; 08-30-2021 at 10:39 AM. Reason: address % vars in log filename |
![]() |
Thread Tools | |
Display Modes | Rate This Thread |
|
|