cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Launch Logger - track each time JMP is launched on a machine
Jeff_Perkinson
Community Manager Community Manager

Launch Logger JMP Add-In, Version 1

Written by Jeff Perkinson, jeff.Perkinson@jmp.com

 

Launch Logger creates a small text file containing system details each time JMP is launched.

 

These text files can be used to track how many times JMP is launched on a given machine. 

 

If a system administrator gathers all of these files across a collection of machines the administrator can track JMP launches across an organization.

 

Launch Logger has no user interface. It uses addinload.jsl to gather system information and write it to the text file.

 

The text file is stored in the directory defined by the JMP Path Variable USER_APPDATA. The location pointed to by this variable depends on the JMP Product and operating system.

 

  • Windows (JMP): C:/Users/<username>/AppData/Roaming/SAS/JMP/<version number>/
  • Windows (JMP Pro): C:/Users/<username>/AppData/Roaming/SAS/JMPPro/<version number>/
  • Macintosh: /Users/<username>/Library/Application Support/JMP/<version number>/

 

The files in this directory are named using the pattern:

 

hostname_date_time.txt

 

where hostname is the name of the machine running JMP and date and time are the launch date and time.

 

The information collected in the text files is:

 

Bitness => 64-bit or 32-bit

Build Information => the build date and time, whether it’s a release or debug build, and the product name in a comma-delimited string 

Date => the date and time that JMP is being launched

Host => Mac or Windows

Hostname => the value of the environment variable COMPUTERNAME (Windows) or HOSTNAME (Mac) 

JMP Version =>  the version of JMP being launched 

Product Name => the name of the JMP product being run, Pro or Standard 

Username => the value of the environment variable USERNAME (Windows) or USER (Macintosh)

 

The text file is written using a syntax that makes it easy to read these values back into an associative array in JMP for aggregating the logs.

 

The contents of addinload.jsl in Launch Logger are:

 

 

info = Associative Array();
info["JMP Version"] = JMP Version();
info["Build Information"] = Build Information();
info["Date"] = Format( Today(), "m/d/y h:m:s" );
info["Host"] = If( Host is( Mac ),
	"Mac",
	"Windows"
);
info["Bitness"] = If( Host is( Bits32 ),
	"32-bit",
	"64-bit"
);
info["Username"] = If( Host is( Windows ),
	Get Environment Variable( "USERNAME" ),
	Get Environment Variable( "USER" )
);
info["Product Name"] = JMP Product Name();
info["Hostname"] = If( Host is( Windows ),
	Get Environment Variable( "COMPUTERNAME" ),
	Get Environment Variable( "HOSTNAME" )
);

dir = "$USER_APPDATA/JMPLaunchLogger/";

filename = dir || info["Hostname"] || "_" || Format( Today(), "ddMONYYYY" ) || "_" || Char( Hour( Today() ) ) || Char( Minute( Today() ) ) ||
Char( Second( Today() ) ) || ".txt";

If( !Directory Exists( dir ),
	dir_create_success = Try( Create Directory( dir ), exception_msg )
);

Save Text File( filename, Char( info ) );

 

Comments

Hi Jeff,

This is awesome - thank you for sharing! Can you confirm that this counts launches from annual license installs only? 

Thanks!

@ashley_prince, no this will count launches from any version of JMP that it is installed in.

jpol

Hi Jeff,

 

I would like to use the Launch Logger Add-In to monitor the number of times JMP is being launched across the company.

I have been successful in having log files created.

 

Unfortunately I am not familiar with the Associative Arrays and therefore find it rather difficult to extract and concatenate the files.

 

Could you provide a couple of hints?

 

Thanks,

 

Philip

@jpol,

 

I must admit you caught me a little short. I thought I was being clever by storing the log information as an Associative Array. It does work well as a self-documenting storage format and allows one to add other information to logs in the future and, presumably, still be able to parse mixed files.

 

However, your inquiry made me realize that it's not as straightforward to get a bunch of Associative Arrays into a data table as I had hoped it would be.

 

With appreciation to @DonMcCormack, here's some code that will create a data table out of a folder of log files.

 

tableFromAAList = Function({inList},{Default Local},
                tblRef = New Table("Data from List of AAs");
 
                For(i=1,i<=N Items(inList),i++,
                                nextKeys = inList[i] << Get Keys;
                                tblRef << Add Row(1);
                                For(j=1,j<=N Items(nextKeys),j++,
                                                nextVal = inList[i] << Get Value(nextKeys[j]);
                                                Try(
                                                                Column(tblRef,nextKeys[j])[i] = nextVal;
                                                ,//ON ERROR
                                                                tblRef << New Column(nextKeys[j],Character);
                                                                Column(tblRef,nextKeys[j])[i] = nextVal;
                                                );
                                )
                );
                tblRef << Delete Columns("Column 1");
);

logfiles = Files In Directory( "./Logs" );
logs = {};
For( i = 1, i <= N Items( logfiles ), i++,
	Insert Into( logs, Parse( Load Text File( "./Logs/" || logfiles[i] ) ) )
);

tableFromAAList(logs);

JMP 14 may make this easier.

 

jpol

Thanks Jeff and Don,

 

This works very well and as local administrator I can easily see the Build Information and JMP version used by each user.

 

Best Regards,

 

Philip

jpol

Hi Jeff,

 

Has anyone reported that the launch logger logs progressively fewer and fewer launches as time goes by?

 

I checked this morning and saw that when I launched JMP myself there was no record ( no text file being stored, as earlier). It seems that my activities have not been logged for a couple of weeks or so.

 

My assumption is that some MS update package has caused this to happen but I cannot be sure. I also noticed that some users never get logged.

 

Any suggestions as to where I can start to investigate?

 

Best Regards,

 

Philip

@jpol, that's odd.

 

Start by looking at the log window to see if there are any messages there immediately after launching JMP.

jpol

Hi Jeff,

 

Nothing in the log window (Ctrl+Shift+L).

 

Less than half of the users are being logged at the moment across the company?

 

I noticed that the Add-In where I had the script embedded has oddly disappeared frommy PC.

Upon re-installation, my JMP launces are now being logged again.

 

Any idea how an Add-In can disappear?

 

- Philip

 

 

Well, if the add-in isn't there it's not surprising that it's not logging anything. ;-)

 

As for how the add-in could go away, that's somehting you probably need to take up with your IT department to see if they are cleaning out the profile directory where the add-ins are installed, or perhaps you've got multiple profile directories.

Recommended Articles