问题
日志分隔,度量日志单独配置。
解决方式。
通过log4j2
其中在 jvm.config 中添加-Dlogfile.name=broker
log4j2 可以通过${sys:logfile.name}获取
%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>