Are you talking about Java Snippets? If you want to print to the console, you can use these print commands, one for each debug level:
logInfo("This is my info message");
logError("This is my error message");
logDebug("This is my debug message");
logWarn("This is my warn message");
Source: