<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