Package com.avoka.core.groovy
Class GroovyLogger
- java.lang.Object
-
- com.avoka.core.groovy.GroovyLogger
-
public class GroovyLogger extends Object
Provides a Groovy Logger class for logging information during the execution of Groovy scripts. Log message are logged to the server log file with the category
com.avoka.core.groovy.GroovyLogger.Example
The Groovy script example below imports the GroovyLogger class with the name 'logger' and then calls the debug, info, warn and error methods.
import com.avoka.core.groovy.GroovyLogger as logger logger.debug 'this is a DEBUG level message' logger.info 'this is an INFO level message' logger.warn 'this is an WARN level message' logger.error 'this is an ERROR level message'
This will result in the following logger messages being logged to the server log file. Note only WARN and ERROR level messages are logged by default.
13:30:33,011 WARN [com.avoka.core.groovy.GroovyLogger] (pool-5-thread-1) this is an WARN level message 13:30:33,012 ERROR [com.avoka.core.groovy.GroovyLogger] (pool-5-thread-1) this is an ERROR level message
Note you can modify the standalone.xml configuration file to change category filtering level to show INFO and DEBUG level messages.
<logger category="com.avoka.core.groovy.GroovyLogger"> <level name="WARN"/> </logger>- Since:
- 4.3.0
-
-
Constructor Summary
Constructors Constructor Description GroovyLogger()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclearTheadLogs()Clear the thread logs.static voiddebug(Object object)Log the given DEBUG level message.static voiddebug(String object)Log the given DEBUG level message.static voiderror(Object object)Log the given ERROR level message.static voiderror(String object)Log the given ERROR level message.static StringBuildergetThreadDebugLevelLog()Return the thread local DEBUG level log.static StringBuildergetThreadInfoLevelLog()Return the thread local INFO level log.static voidinfo(Object object)Log the given INFO level message.static voidinfo(String object)Log the given INFO level message.static voidsetThreadDebugLevelLog(StringBuilder log)Set the thread local DEBUG level log.static voidsetThreadInfoLevelLog(StringBuilder log)Set the thread local INFO level log.static voidwarn(Object object)Log the given WARN level message.static voidwarn(String object)Log the given WARN level message.
-
-
-
Method Detail
-
debug
public static void debug(Object object)
Log the given DEBUG level message.- Parameters:
object- the DEBUG level message
-
debug
public static void debug(String object)
Log the given DEBUG level message.- Parameters:
object- the DEBUG level message
-
error
public static void error(Object object)
Log the given ERROR level message.- Parameters:
object- the ERROR level message
-
error
public static void error(String object)
Log the given ERROR level message.- Parameters:
object- the ERROR level message
-
info
public static void info(Object object)
Log the given INFO level message.- Parameters:
object- the INFO level message
-
info
public static void info(String object)
Log the given INFO level message.- Parameters:
object- the INFO level message
-
warn
public static void warn(Object object)
Log the given WARN level message.- Parameters:
object- the WARN level message
-
warn
public static void warn(String object)
Log the given WARN level message.- Parameters:
object- the WARN level message
-
getThreadDebugLevelLog
public static StringBuilder getThreadDebugLevelLog()
Return the thread local DEBUG level log.- Returns:
- the thread local DEBUG level log
-
setThreadDebugLevelLog
public static void setThreadDebugLevelLog(StringBuilder log)
Set the thread local DEBUG level log.- Parameters:
log- set the thread local DEBUG level log
-
getThreadInfoLevelLog
public static StringBuilder getThreadInfoLevelLog()
Return the thread local INFO level log.- Returns:
- the thread local INFO level log
-
setThreadInfoLevelLog
public static void setThreadInfoLevelLog(StringBuilder log)
Set the thread local INFO level log.- Parameters:
log- set the INFO local debug level log
-
clearTheadLogs
public static void clearTheadLogs()
Clear the thread logs.
-
-