解决dubbo中log4j的问题

springboot整合dubbo启动报异常日志

log4j:WARN No appenders could be found for logger (org.apache.dubbo.common.logger.LoggerFactory).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
.18:11:16.025 [main] INFO  o.a.d.s.b.c.e.WelcomeLogoApplicationListener -

解决方案

1.增加文件
在resources下新增log4j.properties文件
2. 文件内容
log4j.rootLogger=info,ServerDailyRollingFile,stdout

log4j.appender.ServerDailyRollingFile=org.apache.log4j.DailyRollingFileAppender
log4j.appender.ServerDailyRollingFile.DatePattern='.'yyyy-MM-dd
log4j.appender.ServerDailyRollingFile.File=var/log/chinaamc/management-cockpit2.log
log4j.appender.ServerDailyRollingFile.layout=org.apache.log4j.PatternLayout
log4j.appender.ServerDailyRollingFile.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%t] %-5p [%c] - %m%n
log4j.appender.ServerDailyRollingFile.Append=true

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d yyyy-MM-dd HH:mm:ss %p [%c] %m%n

3.设置dubbo 的check =false
dubbo:
  application:
    name:  ims-consumer
  registry:
# TEST环境
    address: 10.16.0.9:2181
    protocol: zookeeper
    check: false

你可能感兴趣的:(log4j,log4j2,java)