Logging scripts makes it slow. Need an alternative

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Scones
Newbie
Posts: 7
Joined: Fri Jul 05, 2019 11:21 am

Logging scripts makes it slow. Need an alternative

Post by Scones » Mon Oct 07, 2019 11:53 am

Hello.

I recently found out how much faster my scripts run without logging enabled, so i want to try and not use it.

My problem:
I have a script with a non modal dialog with a "Send bug report" button. The user presses the button, and the script copies the log file into my bugreport folder and stops the script.

I really need to know where the script froze every time this happens, so the most important thing is that i somehow log which line was executed last when that button is pressed.

Is there any way to do this?

Thanks in advance! :D

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 478
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Logging scripts makes it slow. Need an alternative

Post by Dorian (MJT support) » Mon Oct 07, 2019 12:42 pm

The System Variable _LINE_NUM returns the current line being executed and may be a good starting point for what you're trying to do.

See it in action :

Code: Select all

MessageModal>%_LINE_NUM%
Always accepting custom script commissions. Message me or go here

User avatar
JRL
Automation Wizard
Posts: 3276
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Logging scripts makes it slow. Need an alternative

Post by JRL » Mon Oct 07, 2019 1:52 pm

Another possible method is the to use the "_WRITE_LOG_FILE" system variable. When it is set to "0" logging is suspended until you reset it back to "1". If the script always fails in the same place or places, those may be the only places that need to be logged.

Code: Select all

Let>_WRITE_LOG_FILE=0
//Lines of code not being logged so script runs fast.
.
.
.
//////
Let>_WRITE_LOG_FILE=1
//Lines of code to be logged:
.
.
.
//////
Let>_WRITE_LOG_FILE=0
//Again not logging...etc.

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 478
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Logging scripts makes it slow. Need an alternative

Post by Dorian (MJT support) » Tue Oct 08, 2019 10:19 am

JRL wrote:
Mon Oct 07, 2019 1:52 pm
Another possible method is the to use the "_WRITE_LOG_FILE" system variable. When it is set to "0" logging is suspended until you reset it back to "1". If the script always fails in the same place or places, those may be the only places that need to be logged.

Code: Select all

Let>_WRITE_LOG_FILE=0
//Lines of code not being logged so script runs fast.
.
.
.
//////
Let>_WRITE_LOG_FILE=1
//Lines of code to be logged:
.
.
.
//////
Let>_WRITE_LOG_FILE=0
//Again not logging...etc.
Nice!! :)
Always accepting custom script commissions. Message me or go here

Scones
Newbie
Posts: 7
Joined: Fri Jul 05, 2019 11:21 am

Re: Logging scripts makes it slow. Need an alternative

Post by Scones » Thu Oct 10, 2019 12:11 pm

Thanks to you both! I have something to work with.

Post Reply