# Please think of its meaning by yourself
# Start with 6 level : trace, debug, info, warn, etc
# Any question with this, please ask uncle google for further information
# Set root logger level to DEBUG and its only appender to WebLog.
log4j.rootLogger=WARN, RootLog
log4j.logger.com.myapp.StrutsAction=DEBUG, WebLog
# WebLog is set to be a RollingFileAppender.
log4j.appender.WebLog=org.apache.log4j.RollingFileAppender
log4j.appender.WebLog.file=~/web/groupStructure.log
log4j.appender.WebLog.MaxFileSize=2048KB
log4j.appender.WebLog.MaxBackupIndex=5
# WebLog uses PatternLayout.
log4j.appender.WebLog.layout=org.apache.log4j.PatternLayout
log4j.appender.WebLog.layout.ConversionPattern=%d %c [%p] - %m%n
# RootLog is sent to the Console
log4j.appender.RootLog=org.apache.log4j.ConsoleAppender
log4j.appender.RootLog.layout=org.apache.log4j.PatternLayout
log4j.appender.RootLog.layout.ConversionPattern=%d %c [%p] - %m%n
usage :
import org.apache.log4j.Logger;
public class myAction extends ActionSupport{
private static final Logger log = Logger.getLogger(myAction.class);
private String hello;
@Override
public String execute(){
setHello("Hello World");
log.debug("test Group Structure execute "+hello);
return SUCCESS;
}
}
Tidak ada komentar:
Posting Komentar