Logging Console Output #198
-
|
Hey, I'm working with some custom plugins and they are causing cadwork to crash whilst I'm working. When I have the Test Options > Console open, the error information I need is printed to the console. Is there a way to log this standard output in the console to a text file? If anyone has any insight as to how I can log these errors, I'd greatly appreciate it! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
|
@swatkinson You could try something like this import sys
import traceback
import utility_controller as uc
PLUGIN_PATH = uc.get_plugin_path()
log_file = open(fr"{PLUGIN_PATH}/log.txt", "w")
sys.stderr = log_file
def raise_error():
raise ValueError("some test error")
try:
raise_error()
except Exception as e:
traceback.print_exc()
log_file.close()Does it crash because of your python code ? Or what causes the crash ? |
Beta Was this translation helpful? Give feedback.
-
|
you could may try to use are you doing anything in parallel in your plugins ? |
Beta Was this translation helpful? Give feedback.
-
|
We have this in every of our scripts: Which stores automatically errorlog files in the folder of the script. Makes my life so much easier to keep track of all employees and their bugs |
Beta Was this translation helpful? Give feedback.

@swatkinson
Please do not use Start Debug in Test Options.
You could try something like this
Does it crash because of your python code ? Or what causes the crash ?