1、警告信息
Dubbo项目启动,
"D:\Program files\Java\jdk1.8.0_251\bin\java" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:64091,suspend=y,server=n -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=64090 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=localhost -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -javaagent:C:\Users\86187\.IntelliJIdea2017.3\system\captureAgent\debugger-agent.jar=C:\Users\86187\AppData\Local\Temp\capture17247.props -Dfile.encoding=UTF-8 -classpath "D:\Program files\Java\jdk1.8.0_251\jre\lib\charsets.jar;D:\Program files\Java\jdk1.8.0_251\jre\lib\deploy.jar;E:\studyCode\repository\org\apache\zookeeper\zookeeper\3.3.3\zookeeper-3.3.3.jar;E:\studyCode\repository\jline\jline\0.9.94\jline-0.9.94.jar;E:\studyCode\repository\junit\junit\4.12\junit-4.12.jar;E:\studyCode\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;E:\studyCode\repository\log4j\log4j\1.2.14\log4j-1.2.14.jar;D:\Program files\JetBrains\IntelliJ IDEA 2017.3.5\lib\idea_rt.jar" com.sier.hourglass.ticket.TicketServiceApplication
Connected to the target VM, address: '127.0.0.1:64091', transport: 'socket'
log4j:WARN No appenders could be found for logger (com.alibaba.dubbo.common.logger.LoggerFactory).
log4j:WARN Please initialize the log4j system properly.
████████▄ ███ █▄ ▀█████████▄ ▀█████████▄ ▄██████▄
███ ▀███ ███ ███ ███ ███ ███ ███ ███ ███
███ ███ ███ ███ ███ ███ ███ ███ ███ ███
███ ███ ███ ███ ▄███▄▄▄██▀ ▄███▄▄▄██▀ ███ ███
███ ███ ███ ███ ▀▀███▀▀▀██▄ ▀▀███▀▀▀██▄ ███ ███
███ ███ ███ ███ ███ ██▄ ███ ██▄ ███ ███
███ ▄███ ███ ███ ███ ███ ███ ███ ███ ███
████████▀ ████████▀ ▄█████████▀ ▄█████████▀ ▀██████▀
:: Dubbo :: (v2.6.0)
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.5.RELEASE)
2、解决
main()方法入口添加BasicConfigurator.configure();以使用缺省的log4j环境配置,
如下:
package com.sier.hourglass.ticket;
import org.apache.log4j.BasicConfigurator;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class TicketServiceApplication {
public static void main(String[] args) {
//使用最简的方法配置log4j环境
BasicConfigurator.configure();
SpringApplication.run(TicketServiceApplication.class, args);
}
}
package org.apache.log4j;
public class BasicConfigurator {
protected BasicConfigurator() {
}
public static void configure() {
//默认pattern创建PatternLayout
//创建ConsoleAppender
//给RootLogger添加一个Appender
Logger root = Logger.getRootLogger();
root.addAppender(new ConsoleAppender(new PatternLayout("%r [%t] %p %c %x - %m%n")));
}
3、结果
重启项目,问题解决
"D:\Program files\Java\jdk1.8.0_251\bin\java" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:50427,suspend=y,server=n -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=50426 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=localhost -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -javaagent:C:\Users\86187\.IntelliJIdea2017.3\system\captureAgent\debugger-agent.jar=C:\Users\86187\AppData\Local\Temp\capture22994.props -Dfile.encoding=UTF-8 -classpath "D:\Program files\Java\jdk1.8.0_251\jre\lib\charsets.jar;D:\Program files\Java\jdk1.8.0_251\jre\lib\deploy.jar;" com.sier.hourglass.ticket.TicketServiceApplication
Connected to the target VM, address: '127.0.0.1:50427', transport: 'socket'
0 [main] INFO com.alibaba.dubbo.common.logger.LoggerFactory - using logger: com.alibaba.dubbo.common.logger.log4j.Log4jLoggerAdapter
████████▄ ███ █▄ ▀█████████▄ ▀█████████▄ ▄██████▄
███ ▀███ ███ ███ ███ ███ ███ ███ ███ ███
███ ███ ███ ███ ███ ███ ███ ███ ███ ███
███ ███ ███ ███ ▄███▄▄▄██▀ ▄███▄▄▄██▀ ███ ███
███ ███ ███ ███ ▀▀███▀▀▀██▄ ▀▀███▀▀▀██▄ ███ ███
███ ███ ███ ███ ███ ██▄ ███ ██▄ ███ ███
███ ▄███ ███ ███ ███ ███ ███ ███ ███ ███
████████▀ ████████▀ ▄█████████▀ ▄█████████▀ ▀██████▀
:: Dubbo :: (v2.6.0)