Logging Macros in 7.x
Moderators: Dorian (MJT support), JRL
Logging Macros in 7.x
Just upgraded to 7.x.
This involved changing the calling of macros to a full path to the macro instead of just the "name" of the macro.
How does MS know if and where to log the macro now? I still have the macro defined in MS itself with logging enabled, but unless I run the macro directly from MS, it is not logged.
Thanks.
This involved changing the calling of macros to a full path to the macro instead of just the "name" of the macro.
How does MS know if and where to log the macro now? I still have the macro defined in MS itself with logging enabled, but unless I run the macro directly from MS, it is not logged.
Thanks.
Hi,
This has been improved in the next maintenance release. A called macro will log to the log file of the calling macro - if it has one.
We have also added the ability to set a log file on the command line, so that when running script files from the command line a log file can be declared. Macros already set up with a log file in Macro Scheduler will already log when run from the command line using just the macro name. The new optional log file command line parameter will override this if specified and is useful for when running scripts not configured in Macro Scheduler.
This has been improved in the next maintenance release. A called macro will log to the log file of the calling macro - if it has one.
We have also added the ability to set a log file on the command line, so that when running script files from the command line a log file can be declared. Macros already set up with a log file in Macro Scheduler will already log when run from the command line using just the macro name. The new optional log file command line parameter will override this if specified and is useful for when running scripts not configured in Macro Scheduler.
MJT Net Support
[email protected]
[email protected]
Hi,
I obviously didn't explain myself very well. If a macro is called from another macro (whether a full path is specified or not) then the log file used will be the log file configured for the calling macro.
I.e. if Macro A calls Macro B using the Macro> command, and Macro A has a log file configured for it (whether in it's settings or given on the command line), Macro B will log out to Macro A's log file.
I obviously didn't explain myself very well. If a macro is called from another macro (whether a full path is specified or not) then the log file used will be the log file configured for the calling macro.
I.e. if Macro A calls Macro B using the Macro> command, and Macro A has a log file configured for it (whether in it's settings or given on the command line), Macro B will log out to Macro A's log file.
MJT Net Support
[email protected]
[email protected]
Oh and by the way - we've also added the ability to return values from the called macro to the calling macro.
The variable MACRO_RESULT is returned to the calling macro. So this can be set to whatever you like in the called macro and is transferred to the calling macro.
The variable MACRO_RESULT is returned to the calling macro. So this can be set to whatever you like in the called macro and is transferred to the calling macro.
MJT Net Support
[email protected]
[email protected]
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Nice to finally have the called macro being logged.
But would it also be possible to have the log written under its own name vs. the calling macro name.
If multiple primary macros call a secondary macro, you could only check that the secondary ran by reviewing the logs of all the primary macros.
I am not asking not to include the log as part of the primary, but to actually write two logs, under the calling primary and under its own secondary name. This also allows the ability to retain appending logs if some primary macros overwrite logs and the called secondary macro appends logs.
Thanks for the tools!
But would it also be possible to have the log written under its own name vs. the calling macro name.
If multiple primary macros call a secondary macro, you could only check that the secondary ran by reviewing the logs of all the primary macros.
I am not asking not to include the log as part of the primary, but to actually write two logs, under the calling primary and under its own secondary name. This also allows the ability to retain appending logs if some primary macros overwrite logs and the called secondary macro appends logs.
Thanks for the tools!
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
Hi,
Yes, the /LOGFILE parameter can be used with the Macro> command as well as from the command line. So you could do:
Macro>SubMacroA /LOGFILE=c:\logs\mylog.txt
Without this it would log to the calling macro's log file if it had one.
This functionality will be in 7.1.18 which should be released in the next few days.
Yes, the /LOGFILE parameter can be used with the Macro> command as well as from the command line. So you could do:
Macro>SubMacroA /LOGFILE=c:\logs\mylog.txt
Without this it would log to the calling macro's log file if it had one.
This functionality will be in 7.1.18 which should be released in the next few days.
MJT Net Support
[email protected]
[email protected]
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact: