• log4j配置不同的类多个日志文件


    <Configuration status="INFO">
    <Appenders>
    <Console name="STDOUT" target="SYSTEM_OUT">
    <PatternLayout pattern="[%-5p %d{yyyy-MM-dd HH:mm:ss,SSS}] %m%n"/>
    </Console>
    <RollingFile name="LOG-MAIN" fileName="${logpath}/main.log"
    filePattern="${logpath}/main-%d{yyyy-MM-dd}.log">
    <PatternLayout
    pattern="[%-5p %d{yyyy-MM-dd HH:mm:ss,SSS}] %m%n"/>
    <Policies>
    <TimeBasedTriggeringPolicy interval="1" modulate="true" />
    </Policies>
    <ThresholdFilter level="INFO"/>
    </RollingFile>
    <RollingFile name="LOG-DNHANDLER" fileName="${logpath}/dnHandler.log"
    filePattern="${logpath}/server-%d{yyyy-MM-dd}.log">
    <PatternLayout
    pattern="[%-5p %d{yyyy-MM-dd HH:mm:ss,SSS}] %m%n"/>
    <Policies>
    <TimeBasedTriggeringPolicy interval="1" modulate="true" />
    </Policies>
    <ThresholdFilter level="INFO"/>
    </RollingFile>
    <RollingFile name="LOG-CIDR4DNSLOADER" fileName="${logpath}/cidr4DNSLoader.log"
    filePattern="${logpath}/server-%d{yyyy-MM-dd}.log">
    <PatternLayout
    pattern="[%-5p %d{yyyy-MM-dd HH:mm:ss,SSS}] %m%n"/>
    <Policies>
    <TimeBasedTriggeringPolicy interval="1" modulate="true" />
    </Policies>
    <ThresholdFilter level="INFO"/>
    </RollingFile>
    <RollingFile name="LOG-DNSERVICEIMPL" fileName="${logpath}/dnServiceImpl.log"
    filePattern="${logpath}/server-%d{yyyy-MM-dd}.log">
    <PatternLayout
    pattern="[%-5p %d{yyyy-MM-dd HH:mm:ss,SSS}] %m%n"/>
    <Policies>
    <TimeBasedTriggeringPolicy interval="1" modulate="true" />
    </Policies>
    <ThresholdFilter level="INFO"/>
    </RollingFile>
    </Appenders>

    <Loggers>
    <Root level="${loglevel}">
    <AppenderRef ref="STDOUT"/>
    <AppenderRef ref="LOG-MAIN"/>
    </Root>
    <logger name="com.vh.app.pat.httpdns.handler.DnHandler" level="${loglevel}" additivity="false">
    <AppenderRef ref="LOG-DNHANDLER"/>
    </logger>
    <logger name="com.vh.app.pat.httpdns.data.Cidr4DNSLoader" level="${loglevel}" additivity="false">
    <AppenderRef ref="LOG-CIDR4DNSLOADER"/>
    </logger>
    <logger name="com.vh.app.pat.httpdns.service.imp.DnServiceImpl" level="${loglevel}" additivity="false">
    <AppenderRef ref="LOG-DNSERVICEIMPL"/>
    </logger>
    </Loggers>
    </Configuration>

    类似的在property文件里面配置

    参考:http://blog.sina.com.cn/s/blog_4521e7ac0101g3tz.html

  • 相关阅读:
    爬虫项目数据解析方式
    数据分析
    爬虫项目代理操作和线程池爬取
    Python网络爬虫
    Django多表操作
    网络编程
    python中什么是元类
    Python面向对象中super用法与MRO机制
    mysql之pymysql
    mysql之索引原理
  • 原文地址:https://www.cnblogs.com/gstsyyb/p/5669449.html
Copyright © 2020-2023  润新知