Lombok(1.14.8) - @Log

@Log

@Logs,生成一个日志对象。

package com.huey.lombok;

import lombok.extern.java.Log;

@Log
public class LogExample {

    public static void main(String[] args) {
        log.info("This is an info message.");        
    }

}

 

除了,Log还有其他annotation来封装一些主流的日志类库:
@CommonsLog
Creates private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(Foo.class);
@Log
Creates private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(Foo.class.getName());
@Log4j
Creates private static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(Foo.class);
@Log4j2
Creates private static final org.apache.logging.log4j.Logger log = org.apache.logging.log4j.LogManager.getLogger(Foo.class);
@Slf4j
Creates private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(Foo.class);
@XSlf4j
Creates private static final org.slf4j.ext.XLogger log = org.slf4j.ext.XLoggerFactory.getXLogger(Foo.class);

posted on 2015-08-02 00:47  huey2672  阅读(423)  评论(0编辑  收藏  举报