How to view a ModScript log file without using remote desktop connection

ModScript, at least since version 11.3, added a new "Log" object with methods to allow sending text to a log file in the SBM "Application Engine\Log" directory.  To view these messages you need to start a "Remote Desktop Connection", aka "Remote Console" or RDP to the AE server and view the log file in the "Application Engine\log" directory.  Previously, this kind of logging was done using the "Ext.LogInfoMsg" call which sent the message to the AE server's Windows Application Event log.  To view these log messages, you also had to "remote" into the AE server, then use the Windows Event Viewer to view the Application Event log.  That level of access can make some clients or server administrators nervous.  In some conditions, the developer may not have any access to SBM servers.

Fortunately, there's a way to create a log that doesn't require any remote access to the AE server, outside of IIS.

Some basic "one time" setup is necessary to allow this capability. Have someone with "administrator" privileges on the SBM AE server do the following steps:

  1. "remote" into the SBM AE server
  2. "CD" to IIS's "inetpub\wwwroot" directory.
  3. Create a subdirectory under "inetpub\wwwroot" for the ModScript log files.  In this example the name of the subdir is "AE-Logs".
  4. Use the Microsoft Sys Internals "junction" tool "junction" to create a file junction from "inetpub\wwwroot\AE-Logs" that is targeted at a subdirectory (which the "junction" command will create) under the App Engine's "Log" directory.  In this example the name of the subdir under "Application Engine\Log" is called "inetpub_AE-logs".

junction  "C:\inetpub\wwwroot\AE-logs"   "F:\Program Files\Serena\SBM\Application Engine\Log\inetpub_AE-logs"

Now your ModScript can use the following calls to create a Log file in that new subdir.  Make sure that the name of the log file you create has a file extension that IIS will handle, like ".txt" or ".htm".  On my system, IIS will not handle a file with the ".log" extension.  I can probably change that by making changes to the IIS settings.

var my_IIS_log Log() ;
my_IIS_log.Open("inetpub_AE-logs/ModScript_log.txt");
my_IIS_log.SetWantTimeStamp(true);
my_IIS_log.Message( LogLevelConstants.AVERAGE, "0 param call to my_IIS_log.Message" );
my_IIS_log.Message( LogLevelConstants.AVERAGE, "3 param call to my_IIS_log.Message : Reporting Level={0} : File={1} : IsOpen={2}" , my_IIS_log.GetReportingLevel() , my_IIS_log.GetFileName() , my_IIS_log.IsOpen() );

 

View the log in a browser:

https://-MY-AE-SERVER-/AE-logs/ModScript_log.txt

New Course: Dimensions CM 14.5 Essentials
What's new in Visual Studio Integration in 14.5

Related Posts

Recent Tweets