Logs in Mid Server Script File

Sagar V1
Mega Expert

Hi,

Any idea on adding logs in Mid Server Script Files.

For example, there is OOTB script - ActiveDirectory.psm1 and have log messages - SNCLog-ParameterInfo and SNCLog-DebugInfo. I wanted to check the output of these logs. Anyone know where these logs will be displayed. Is there any property that needs to be activated to display logs. Or any other method to debug PowerShell script present here.

Thanks,
Sagar

4 REPLIES 4

robertgeen
Tera Guru

I don't know if these will work in the specific one you want but ms.log is typically how you output to mid server logs for scripts that are running on the mid server. Hope this helps and if it does mark as correct answer. Thanks.

Hardik Benani
Mega Sage
Mega Sage

You can add logs in the MidServer files by using ms.log("Log Statement");

These logs will be printed in MidServer logs files. In case you need to view those logs, goto the MidServer record and use the UI Action "Grab MID logs" 

https://docs.servicenow.com/bundle/istanbul-servicenow-platform/page/product/mid-server/task/t_AccessMIDServerLogsECC.html 

 

 

Note: If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.

Andrzej Krawcz1
Kilo Contributor

You have to change configuration parameter mid.property.powershell.log_info for your MID server to true.

Then the logs should become visible in ECC queue inputs under log_info tag

kshitiz11
Tera Expert

 

@Andrzej Krawcz1 Correct

List of all logs can be found under [ecc_queue.list]

For example, if you need Powershell file execution output

1. GoTo > ecc_queue.list

2. Topic=powershell,

3. Agent=<your_mid_server>

Open the desired record and check the Payload section with all your "echo" logs getting executed.

 

image.png

 

 

 

Thanks