简体   繁体   English

在 Json 模式中显示 Cloudhub 日志以及自定义字段

[英]Display Cloudhub Logs in Json Pattern along with Custom fields

Our client is not interested in using any 3rd party Logger like JSON Logger or any other logger comnectors available.我们的客户对使用任何第 3 方记录器不感兴趣,例如 JSON 记录器或任何其他可用的记录器连接器。 So is there any way to modify the default Anypoint Logging pattern in cloudhub in Json format like how a Json Logger does.那么有没有办法像 Json Logger 那样以 Json 格式修改 cloudhub 中的默认 Anypoint Logging 模式。 Is there any way to add custom fields using default logger like api_name or flow_start_time, end_time?有什么方法可以使用默认记录器(如 api_name 或 flow_start_time、end_time)添加自定义字段? Currently I am creating a variable and defining required fields in a Json pattern and further configure the variable in the default logger which is a workaround and working fine but its just I was curious if this is possible in some easier way without writing any dwl?目前,我正在创建一个变量并在 Json 模式中定义必填字段,并在默认记录器中进一步配置该变量,这是一种解决方法并且工作正常但我只是好奇这是否可以通过更简单的方式实现而无需编写任何 dwl?

You can add custom variables using Mule 4.4 MDC logging feature.您可以使用 Mule 4.4 MDC 日志功能添加自定义变量。 Note that it is not available with previous versions.请注意,它不适用于以前的版本。

You can also request to override the default logging configuration in CloudHub, otherwise the log4j2.xml in the application is ignored, and try to use the JsonLayout.也可以请求 覆盖CloudHub中默认的日志配置,否则应用中的log4j2.xml会被忽略,尝试使用JsonLayout。 I don't recommend it though.我不推荐它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM