NutzCN Logo
问答 老板来看下log4j 1.x 的log4j.properties怎么改成log4j 2.x的配置文件
发布于 3299天前 作者 qq_787ee077 2848 次浏览 复制 上一个帖子 下一个帖子
标签: log log4j

内容支持 Markdown 语法, 使用菜单栏的代码块标注代码,不要上传代码的截图!!

log4j.rootLogger=DEBUG,Console,F

#If you set nutz's level to INFO,but want to see all SQL , uncomment next 2 line
#log4j.logger.org.nutz=INFO
#log4j.logger.org.nutz.dao.impl.sql.run=DEBUG

log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=%d [%t] %-5p %c - %m%n


log4j.appender.F=org.apache.log4j.FileAppender
log4j.appender.F.layout=org.apache.log4j.PatternLayout
log4j.appender.F.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
log4j.appender.F.file=output.log

http://logging.apache.org/log4j/2.x/manual/configuration.html

1 回复

我来解决吧

<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
  <Appenders>
    <Console name="STDOUT" target="SYSTEM_OUT">
      <PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
    </Console>
  </Appenders>
  <Loggers>
    <Root level="debug">
      <AppenderRef ref="STDOUT"/>
    </Root>
    <Logger name="org.apache.commons.beanutils" level="info"/>
    <Logger name="org.quartz.core.QuartzSchedulerThread" level="info"/>
    <Logger name="org.apache.shiro.web" level="info"/>
    <Logger name="net.sf.ehcache.statistics" level="info"/>
    <Logger name="io.netty.util.internal" level="info"/>
    <Logger name="net.sf.ehcache.store.disk.Segment" level="info"/>
    <Logger name="com.corundumstudio.socketio" level="info"/>
    <Logger name="org.apache.shiro.mgt.DefaultSecurityManager" level="info"/>
    <Logger name="org.apache.shiro.web.servlet.SimpleCookie" level="info"/>
    <Logger name="org.apache.log4j.xml" level="debug"/>
  </Loggers>
</Configuration>
添加回复
请先登陆
回到顶部