問題app
日誌分隔,度量日誌單獨配置。jvm
解決方式。日誌
經過log4j2 code
其中在 jvm.config 中添加-Dlogfile.name=brokerxml
log4j2 能夠經過${sys:logfile.name}獲取ci
%d{yyyy-MM-dd HH:mm:ss} [%t] %-5p %c{1}:%L - %msg%n
<Configuration status="WARN"> <properties> <property name="pattern">%d{yyyy-MM-dd HH:mm:ss.SSS} %c{1.} %t [%p] %msg%n</property> <property name="patternNoTime">%msg%n</property> <property name="patternMetrics">%d %-8r %m%n</property> <property name="logPath">logs</property> </properties> <appenders> <RollingFile name="STDOUT" fileName="${logPath}/${sys:logfile.name}.log" filePattern="${logPath}/${sys:logfile.name}-%d{yyyy-MM-dd}.log.%i.gz"> <PatternLayout> <pattern>${patternNoTime}</pattern> </PatternLayout> <Policies> <SizeBasedTriggeringPolicy size="100 MB"/> <!-- Or every 100 MB --> </Policies> <DefaultRolloverStrategy max="4"/> </RollingFile> <RollingFile name="METRICS" fileName="${logPath}/${sys:logfile.name}.metrics" filePattern="${logPath}/${sys:logfile.name}-%d{yyyy-MM-dd}.metrics.%i.gz"> <PatternLayout> <pattern>${patternMetrics}</pattern> </PatternLayout> <Policies> <SizeBasedTriggeringPolicy size="50 MB"/> </Policies> <DefaultRolloverStrategy max="4"/> </RollingFile> </appenders> <loggers> <Root level="info"> <appender-ref ref="STDOUT"/> </Root> <Logger name="com.metamx.emitter.core.LoggingEmitter" level="error" additivity="false"> <appender-ref ref="METRICS"/> </Logger> </loggers> </Configuration>