If you use log.info/warn/debug(message) in your code, the default WGA logger will be used to log your messages. Because the default log level of this logger is "info", log.debug(message) will never appear in the console.
During development however you need debug messages.
Most developers therefore use log.info() instead of log.debug() during development and remove all log.info-s when deploying to production server.
We now added the possibility to use your own logger in TMLScript by using the new WGA.Logger(name) method.
WGA.Logger(name) returns a WGALogger object, that has two usefull methods
getLogger() // returns the Log4J Logger object
setLevel(loglevel) // sets the log level for this logger
// possible values are "debug", "info", "warn" and "error"
var log = WGA.Logger("test").getLogger();
This creates a custom logger with effective name "wga.test". The default log-level still is "info" so the debug message will still not appear on the console. You can however now change this in two ways:
somewhere in your script to activate debug messages.
2) Start OpenWGA with system option
The second method is preferred as you don't need to change your code when going live.
If you need to debug a production server you can temporary enable debugging via TMLScript-Console by just executing
If your debugging session ist finished reset the logger by executing
Note: If you prefer console.log()/console.debug() over log.info()/log.debug() you can still use named Loggers:
console.logger = WGA.Logger("test").getLogger();