GSlog is the best way to output log infos from ServiceNow server scripts. Consider this snippet to get started.
var logger = new global.GSLog('','My script');
logger.setLevel(global.GSLog.DEBUG);
logger.includeTimestamp();
logger.logDebug('Hello World');