[fix](log4j) fix some issues when modify log config (#21099)
Co-authored-by: caiconghui1 <caiconghui1@jd.com>
This commit is contained in:
@ -47,7 +47,7 @@ public class Log4jConfig extends XmlConfiguration {
|
||||
+ " <Pattern>%d{yyyy-MM-dd HH:mm:ss,SSS} %p (%t|%tid)<!--REPLACED BY LOG FORMAT-->%m%n</Pattern>\n"
|
||||
+ " </PatternLayout>\n"
|
||||
+ " </Console>"
|
||||
+ " <RollingFile name=\"Sys\" fileName=\"${sys_log_dir}/fe.log\" filePattern=\"${sys_log_dir}/fe.log.${sys_file_pattern}-%i\">\n"
|
||||
+ " <RollingFile name=\"Sys\" fileName=\"${sys_log_dir}/fe.log\" filePattern=\"${sys_log_dir}/fe.log.${sys_file_pattern}-%i\" immediateFlush=\"${immediate_flush_flag}\">\n"
|
||||
+ " <PatternLayout charset=\"UTF-8\">\n"
|
||||
+ " <Pattern>%d{yyyy-MM-dd HH:mm:ss,SSS} %p (%t|%tid)<!--REPLACED BY LOG FORMAT-->%m%n</Pattern>\n"
|
||||
+ " </PatternLayout>\n"
|
||||
@ -62,7 +62,7 @@ public class Log4jConfig extends XmlConfiguration {
|
||||
+ " </Delete>\n"
|
||||
+ " </DefaultRolloverStrategy>\n"
|
||||
+ " </RollingFile>\n"
|
||||
+ " <RollingFile name=\"SysWF\" fileName=\"${sys_log_dir}/fe.warn.log\" filePattern=\"${sys_log_dir}/fe.warn.log.${sys_file_pattern}-%i\">\n"
|
||||
+ " <RollingFile name=\"SysWF\" fileName=\"${sys_log_dir}/fe.warn.log\" filePattern=\"${sys_log_dir}/fe.warn.log.${sys_file_pattern}-%i\" immediateFlush=\"${immediate_flush_flag}\">\n"
|
||||
+ " <PatternLayout charset=\"UTF-8\">\n"
|
||||
+ " <Pattern>%d{yyyy-MM-dd HH:mm:ss,SSS} %p (%t|%tid)<!--REPLACED BY LOG FORMAT-->%m%n</Pattern>\n"
|
||||
+ " </PatternLayout>\n"
|
||||
@ -94,7 +94,7 @@ public class Log4jConfig extends XmlConfiguration {
|
||||
+ " </RollingFile>\n"
|
||||
+ " </Appenders>\n"
|
||||
+ " <Loggers>\n"
|
||||
+ " <Root level=\"${sys_log_level}\" includeLocation=\"${include_location_flag}\" immediateFlush=\"${immediate_flush_flag}\">\n"
|
||||
+ " <Root level=\"${sys_log_level}\" includeLocation=\"${include_location_flag}\">\n"
|
||||
+ " <AppenderRef ref=\"Sys\"/>\n"
|
||||
+ " <AppenderRef ref=\"SysWF\" level=\"WARN\"/>\n"
|
||||
+ " <!--REPLACED BY Console Logger-->\n"
|
||||
|
||||
@ -90,7 +90,7 @@ public class LogController {
|
||||
}
|
||||
if (!Strings.isNullOrEmpty(delVerboseName)) {
|
||||
delVerboseName = delVerboseName.trim();
|
||||
List<String> verboseNames = Lists.newArrayList(configs.y);
|
||||
List<String> verboseNames = Lists.newArrayList(configs.z);
|
||||
if (verboseNames.contains(delVerboseName)) {
|
||||
verboseNames.remove(delVerboseName);
|
||||
configs = Log4jConfig.updateLogging(null, null,
|
||||
@ -100,8 +100,9 @@ public class LogController {
|
||||
}
|
||||
|
||||
map.put("Level", configs.x);
|
||||
map.put("VerboseNames", StringUtils.join(configs.y, ","));
|
||||
map.put("AuditNames", StringUtils.join(configs.z, ","));
|
||||
map.put("Mode", configs.y);
|
||||
map.put("VerboseNames", StringUtils.join(configs.z, ","));
|
||||
map.put("AuditNames", StringUtils.join(configs.u, ","));
|
||||
content.put("LogConfiguration", map);
|
||||
} catch (IOException e) {
|
||||
LOG.error(e);
|
||||
|
||||
@ -56,7 +56,8 @@ export default function Logs(params: any) {
|
||||
<Typography style={{padding: '30px'}}>
|
||||
<Title>Log Configuration</Title>
|
||||
<Paragraph>
|
||||
<p>Level: {LogConfiguration.VerboseNames}</p>
|
||||
<p>Level: {LogConfiguration.Level}</p>
|
||||
<p>Mode: {LogConfiguration.Mode}</p>
|
||||
<p>Verbose Names:{LogConfiguration.VerboseNames}</p>
|
||||
<p>Audit Names: {LogConfiguration.AuditNames}</p>
|
||||
</Paragraph>
|
||||
|
||||
Reference in New Issue
Block a user