Writing variables out to a file in TruClients

I am capturing values to write out to a file so i know the data i processed and if it brought back records.  I did this type of code:

var loginId = TC.getParam("p_User_ID");
var logMsg = TC.log('LastName: ' loginId);
IO.write(TC.scriptDir "mylog.txt", logMsg, false);

the logMsg gives me this in the log: LastName: burjuxx  (which is correct)

but the IO.write statement gives me junk.  is there a way to write out to a log a value captured in TruClient? I can get it to work if I put a string in place like

IO.write(TC.scriptDir "mylog.txt", "string", false);