Package com.avoka.core.groovy
Class GroovyLogger
java.lang.Object
com.avoka.core.groovy.GroovyLogger
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
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Clear the thread logs.static void
Log the given DEBUG level message.static void
Log the given DEBUG level message.static void
Log the given ERROR level message.static void
Log the given ERROR level message.static StringBuilder
Return the thread local DEBUG level log.static StringBuilder
Return the thread local INFO level log.static void
Log the given INFO level message.static void
Log the given INFO level message.static void
Set the thread local DEBUG level log.static void
Set the thread local INFO level log.static void
Log the given WARN level message.static void
Log the given WARN level message.
-
Constructor Details
-
GroovyLogger
public GroovyLogger()
-
-
Method Details
-
debug
Log the given DEBUG level message.- Parameters:
object
- the DEBUG level message
-
debug
Log the given DEBUG level message.- Parameters:
object
- the DEBUG level message
-
error
Log the given ERROR level message.- Parameters:
object
- the ERROR level message
-
error
Log the given ERROR level message.- Parameters:
object
- the ERROR level message
-
info
Log the given INFO level message.- Parameters:
object
- the INFO level message
-
info
Log the given INFO level message.- Parameters:
object
- the INFO level message
-
warn
Log the given WARN level message.- Parameters:
object
- the WARN level message
-
warn
Log the given WARN level message.- Parameters:
object
- the WARN level message
-
getThreadDebugLevelLog
Return the thread local DEBUG level log.- Returns:
- the thread local DEBUG level log
-
setThreadDebugLevelLog
Set the thread local DEBUG level log.- Parameters:
log
- set the thread local DEBUG level log
-
getThreadInfoLevelLog
Return the thread local INFO level log.- Returns:
- the thread local INFO level log
-
setThreadInfoLevelLog
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.
-