[SOLVED] log.debug with Javascript

All Union Platform questions, comments, feature requests, and bug reports.

log.debug with Javascript  

Postby jjMedina » Sat 21 Sep 2013 16:20

Hey there,

I'm developing a game using a javascript Room Module.

I'm trying to debug the room module, and in some examples (mostly from reading @toby's posts), I see that the line-
log.debug("message");
is used... But when I try to use it in my room module, it breaks the file and I get a "ROOM_NOT_FOUND" upc message in the console and union admin.
I've also tried variations of-
var log = new net.user1.logger.Logger;

How should I debug, or more simply write to the console log, from a javascript room module?

-thx
jj
jjMedina
 
Posts: 5
Joined: Fri 06 Sep 2013 17:21

Re: log.debug with Javascript

Postby toby » Mon 23 Sep 2013 21:31

First make sure the log is configured in
/union/lib/log4j.properties

(If union is writing any log stuff at all ... you're ok on that).

Then put this code at the global top of your module code:

// this is probably what you're missing
importClass(org.apache.log4j.Logger);
var log = Logger.getLogger("union"); // where "union" should match what's in log4j.properties


// Then sprinkle these in your code as you like:
log.debug("debug message");
log.info("info level message");
toby
 
Posts: 162
Joined: Sun 24 Jun 2012 14:18


Return to Union Platform

Online

Users browsing this forum: No registered users and 9 guests