「Log4j2.xml」複数のAppenderを設定する方法
使用例
<?xml version="1.0" encoding="UTF-8"?> <Configuration> <Properties> <Property name="logfmt">%d %-5p %c %m%n</Property> </Properties> <Appenders> <Console name="stdout" target="SYSTEM_OUT"> <PatternLayout pattern="${logfmt}" /> </Console> <File name="file" fileName="C:\\cft\\logs\\debug.log"> <PatternLayout pattern="${logfmt}" /> </File> </Appenders> <Loggers> <Logger name="com.sample.build additivity="false" level="DEBUG"> <AppenderRef ref="stdout" level="DEBUG"/> <AppenderRef ref="file" level="INFO"/> </Logger> </Loggers> </Configuration>