#log4j.rootLogger=DEBUG,A1,R
log4j.rootLogger=INFO,A1,R
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss,SSS} [%c]-[%p] %m%n
log4j.appender.R=org.apache.log4j.RollingFileAppender
#log4j.appender.R.File=c:/seaport.log
log4j.appender.R.File=./Log4Jdemo02.log
log4j.appender.R.MaxFileSize=1024KB
log4j.appender.R.MaxBackupIndex=1
#log4j.appender.R.layout=org.apache.log4j.HTMLLayout
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} [%t] [%c] [%p] - %m%n
public class TestService
{
public static Logger logger = Logger.getLogger(TestService.class);
/**
* @param args
*/
public static void main(String[] args)
{
// ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
// PersonService person = (PersonService)context.getBean("person");
// person.setName("德华");
// person.setAge(20);
// System.out.println(person.toString());
// SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
logger.debug("this is debug message");
logger.info("this is info message");
logger.error("this is error message");
}
}