How do I get logging to work
Moderators: Dorian (MJT support), JRL
-
- Junior Coder
- Posts: 25
- Joined: Sun Dec 15, 2013 9:27 pm
How do I get logging to work
Hello
I want to enable logging for my scripts, however I cannot figure out how to do this.
I've gone to the Logging tab and specified a log file eg.
C:\Logging\ScriptName.txt
However this does not appear to do anything. I cannot find any info on how to do this. If some-one could provide to guidance I would appreciate it.
Kind regards
Trevor
I want to enable logging for my scripts, however I cannot figure out how to do this.
I've gone to the Logging tab and specified a log file eg.
C:\Logging\ScriptName.txt
However this does not appear to do anything. I cannot find any info on how to do this. If some-one could provide to guidance I would appreciate it.
Kind regards
Trevor
Re: How do I get logging to work
Did you notice this little snippet at the top?
I'm thinking this means you have to compile and run.Note: Logging has no effect when scripts are run within the debugger.
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: How do I get logging to work
You certainly do not need to compile it. This has nothing to do with compiling (in fact if you compile you need to either pass a log file to the .exe when you run it or build that in with the compile settings).
Believe it or not it means precisely what it says - logging has no effect when running in the debugger. If that makes no sense we better talk about what the debugger is. You are using the debugger when you run code while you are in the editor.
** if you can see your code you are in the debugger **
If you CLOSE the script editor and then run the macro the logging will take effect.
So the logging works when:
- You run the macro from the main window (where you see a list of macros)
- When a schedule runs the macro
- When a hotkey runs the macro
- When you run the macro from a shortcut
- When you run the macro from the system tray Quick Launch option.
So basically once you have defined logging it will ALWAYS work UNLESS you open up the macro in the editor and run from within there. If you are editing you are debugging when you run. Logging has no effect in this instance.
Believe it or not it means precisely what it says - logging has no effect when running in the debugger. If that makes no sense we better talk about what the debugger is. You are using the debugger when you run code while you are in the editor.
** if you can see your code you are in the debugger **
If you CLOSE the script editor and then run the macro the logging will take effect.
So the logging works when:
- You run the macro from the main window (where you see a list of macros)
- When a schedule runs the macro
- When a hotkey runs the macro
- When you run the macro from a shortcut
- When you run the macro from the system tray Quick Launch option.
So basically once you have defined logging it will ALWAYS work UNLESS you open up the macro in the editor and run from within there. If you are editing you are debugging when you run. Logging has no effect in this instance.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Re: How do I get logging to work
Not so fast, Marcus! I don't think that instruction is quite as clear as you think.
In Scripting Windows for Beginners, under Using Macro Scheduler, there's this:
Further, if you search for Debugger in the Help Index, you'll see this:
Clearly, the debugger is a feature of the Script Editor, accessible only from within the menu of the Script Editor. Besides, what sense would it make to have a debugger within the Debugger?
Even your post switches to the correct term in order to clarify your meaning (emphasis added by me):
I would respectfully suggest that your disclaimer description really means that logging has no effect when scripts are run from within the Script Editor, whether using the Debugger or not.
Lastly, I'd encourage you to update the contents of the Help file for the index entry Editor.
The good news is that this is exactly why I keep returning to these forums...for clarity!
Thanks for everything!
In Scripting Windows for Beginners, under Using Macro Scheduler, there's this:
Clicking the link will reveal the Script Editor.Select File/New Macro from the main menu or click the New toolbar button. This will open an empty new macro and put you directly in the Script Editor.
Further, if you search for Debugger in the Help Index, you'll see this:
Clearly, the debugger is a feature of the Script Editor, accessible only from within the menu of the Script Editor. Besides, what sense would it make to have a debugger within the Debugger?
Even your post switches to the correct term in order to clarify your meaning (emphasis added by me):
What my limited testing has revealed is that it works exactly as you described. When you're debugging, the logging doesn't work, and when you're running the script from within the Script Editor, the logging doesn't work there either. It's not until you close the script and run it outside of the Script Editor that the logging begins to work.Believe it or not it means precisely what it says - logging has no effect when running in the debugger. If that makes no sense we better talk about what the debugger is. You are using the debugger when you run code while you are in the editor.
** if you can see your code you are in the debugger **
If you CLOSE the script editor and then run the macro the logging will take effect.
I would respectfully suggest that your disclaimer description really means that logging has no effect when scripts are run from within the Script Editor, whether using the Debugger or not.
Lastly, I'd encourage you to update the contents of the Help file for the index entry Editor.
The good news is that this is exactly why I keep returning to these forums...for clarity!
Thanks for everything!
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: How do I get logging to work
The Script Editor = The Debugger. When you run a script in the script editor you see the watch list. Always.
I could add "the script editor is the debugger" in the help file. I'll do that. How much do you want to bet people will read it?
I could add "the script editor is the debugger" in the help file. I'll do that. How much do you want to bet people will read it?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Re: How do I get logging to work
I only know of one guy who's read it so far.
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey
-
- Junior Coder
- Posts: 25
- Joined: Sun Dec 15, 2013 9:27 pm
Re: How do I get logging to work
Thank you for the comments on this question.
For clarity from my perspective, for a number of reasons I always run scripts with the Script Editor open. This is because I am using Macro Scheduler to test our applications which can be very flakey.
If I want to use logging I would need to compile the script(?) using a copy of Macro Scheduler Pro(?) which I have, into an EXE and then run the EXE. I assume that doing this will allow the logging to work?
For clarity from my perspective, for a number of reasons I always run scripts with the Script Editor open. This is because I am using Macro Scheduler to test our applications which can be very flakey.
If I want to use logging I would need to compile the script(?) using a copy of Macro Scheduler Pro(?) which I have, into an EXE and then run the EXE. I assume that doing this will allow the logging to work?
Re: How do I get logging to work
No, you don't have to compile, just run it from this view:
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey
- Dorian (MJT support)
- Automation Wizard
- Posts: 1380
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: How do I get logging to work
Yes, MightCPA is correct. Thank you for clarifying.mightycpa wrote:No, you don't have to compile, just run it from this view:
Yes, we have a Custom Scripting Service. Message me or go here
Trick to getting logging working in compiled script?
My compiled script won't produce a log.
I've done this:
and this:
The only unusual thing is that the path for my log does not exist on the machine where I'm compiling. It exists on the machine I'm running the compiled version on. That shouldn't make a difference, should it?
What else do I need to do? The log simply does not get produced, and I need it.
I've done this:
and this:
The only unusual thing is that the path for my log does not exist on the machine where I'm compiling. It exists on the machine I'm running the compiled version on. That shouldn't make a difference, should it?
What else do I need to do? The log simply does not get produced, and I need it.
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey
Re: How do I get logging to work
Once a script is compiled, the Macro Scheduler menu no longer has any impact on the stand alone executable file or its processing. You will need to compile with the "Disable logging" checkbox unchecked. To log an executable you need to run the executable from some sort of command line. The command line will say something like:
MyScript.exe /logfile=logfile.txt
Typically I will create a shortcut to run the command line. You can also run one from a DOS shell or from another Macro Scheduler script.
MyScript.exe /logfile=logfile.txt
Typically I will create a shortcut to run the command line. You can also run one from a DOS shell or from another Macro Scheduler script.
Re: How do I get logging to work
Hi JRL,
I just found this thread:
viewtopic.php?f=2&t=9188&p=40199&hilit= ... exe#p40199
and it basically showed me what you just said, and yes, it works.
In that same thread, you wrote about _WRITE_LOG_FILE=1 or 0 where 1 means write and 0 means don't. That didn't work for me. I mostly don't want to log, I'm have a very specific issue and I just wanted to log a few lines, but I can't see how to do it. Any thoughts on that? Example:
It just keeps on logging after that.
What I did see, which was an unexpected treat, was that if I had a line like this:
I could see the values in the commented line, like so:
If I could turn most of the logging off, that would be great.
I just found this thread:
viewtopic.php?f=2&t=9188&p=40199&hilit= ... exe#p40199
and it basically showed me what you just said, and yes, it works.
In that same thread, you wrote about _WRITE_LOG_FILE=1 or 0 where 1 means write and 0 means don't. That didn't work for me. I mostly don't want to log, I'm have a very specific issue and I just wanted to log a few lines, but I can't see how to do it. Any thoughts on that? Example:
Code: Select all
Let>_WRITE_LOG_FILE=1
//MessageModal>vfilectr is %v_file_ctr% and vfilelistcount is %v_file_list_COUNT%
Until>v_file_ctr>%v_file_list_COUNT%
Let>_WRITE_LOG_FILE=0
What I did see, which was an unexpected treat, was that if I had a line like this:
Code: Select all
//MessageModal> My var value is %var_value%
Too cool for school!3/31/2017 23:41:14:686 - START: 215: //MessageModal>vfilectr is 15 and vfilelistcount is 106
3/31/2017 23:41:14:686 - END: 215: //MessageModal>vfilectr is 15 and vfilelistcount is 106
If I could turn most of the logging off, that would be great.
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey
Re: How do I get logging to work
Hi JRL,
I got it! Put a _WRITE_LOG_FILE=0 up at the top of the script..... DUH!
OK, thanks for all your assistance.
I got it! Put a _WRITE_LOG_FILE=0 up at the top of the script..... DUH!
OK, thanks for all your assistance.
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey