Metastorm BPM : Writing to the event log

As well as trying to write an audit log (a more advanced log than what Metastorm BPM provides in its admin forms), I always tend to write errors into the event log or to a text file as a backup. There is of course the argument that cluttering the event log with errors isn’t best practice and can be expensive, however my belief is that this very point is the reason why you should insert errors into the log. The less log entries the better performing system you have and ultimately that is what you want from your Metastorm procedures. Below is the standard class I use to record entries into the log and as a backup, write to a text file.

package ErrorLogger

public class ErrorLog

var SUCCESS : int =0;
public static var ERROR : int =1;
var WARNING : int =2;
var INFORMATION : int =4;
var AUDIT_SUCCESS : int =8;
var AUDIT_FAILURE : int =12;

public static function LogError(intLogLevel:int, strMsg:String):Boolean
//Attempt event log write


var objShell = new ActiveXObject(“Wscript.Shell”);
objShell.LogEvent(intLogLevel, strMsg);
return true;


//If unable to write into event log, try writing to local txt file instead
catch( ex:Exception )

var fso = new ActiveXObject(“Scripting.FileSystemObject”);
var FileObject = fso.OpenTextFile(“C:\\MyLogFile.txt”, 8, true,0); // 8=append, true=create if doesn’t already exist, 0 = ASCII new Object.





Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s