Created
September 21, 2012 01:22
-
-
Save grimrose/3759266 to your computer and use it in GitHub Desktop.
groovy script with logback
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Built on Fri Sep 21 02:55:59 CEST 2012 by logback-translator | |
// For more information on configuration files in Groovy | |
// please see http://logback.qos.ch/manual/groovy.html | |
// For assistance related to this tool or configuration files | |
// in general, please contact the logback user mailing list at | |
// http://qos.ch/mailman/listinfo/logback-user | |
// For professional support please see | |
// http://www.qos.ch/shop/products/professionalSupport | |
import ch.qos.logback.classic.encoder.PatternLayoutEncoder | |
import ch.qos.logback.core.ConsoleAppender | |
import static ch.qos.logback.classic.Level.* | |
appender("STDOUT", ConsoleAppender) { | |
encoder(PatternLayoutEncoder) { | |
pattern = "%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n" | |
} | |
} | |
root(INFO, ["STDOUT"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grapes([ | |
@GrabConfig(systemClassLoader=true), | |
@Grab(group='org.slf4j', module='slf4j-api', version='1.6.6'), | |
@Grab(group='ch.qos.logback', module='logback-classic', version='1.0.6') | |
]) | |
import org.slf4j.* | |
import groovy.util.logging.Slf4j | |
@Slf4j | |
class Receiver { | |
void receive(String input) { | |
log.debug "debug: input is ${input}." | |
log.info "info: input is ${input}." | |
} | |
} | |
def receiver = new Receiver() | |
receiver.receive("Hello") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment