Log4j является одним из лучших лесозаготовок для заводной
import groovy.util.logging.Log4j
@Log4j
public class MyClass{
//Use for logger check
public static void myMethod(){
//log.error(null, "This is the log message", throwable)
//log.error(null, "This is the log message", throwable)
//log.info("This is the message for info")
//log.debugg("This is the message for debugging")
}
}
Log4j.properties
# Define the root logger with appender file
log =folderpath
log4j.rootLogger=INFO, R, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
# %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%C:%L [%t] - %m%n
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=${log}/filename.log
log4j.appender.R.MaxFileSize=2048KB
# Keep one backup file
log4j.appender.R.MaxBackupIndex=1
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern="%d %5p %c{1}:%L - %m%n"
# %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%C:%L [%t] - %m%n
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
Надеюсь, это поможет вам ....