简体   繁体   English

打印日志的通用实体

[英]Generic Entity for print logs

I have a need in a project and I don't really know how to do the architecture (springboot, with Kubernetes deployment).我有一个项目的需求,但我真的不知道如何做架构(springboot,使用 Kubernetes 部署)。

I need to have a microservice only for logs, that is, that paints everything that I send to it in the log.我需要一个只用于日志的微服务,也就是说,它可以在日志中绘制我发送给它的所有内容。

At first I wanted to send it (log[debug, info, error], client number, entity), but that entity must be generic and I would like to paint a ToString of said entity in the Log4J line.起初我想发送它(log[debug, info, error], client number, entity),但该实体必须是通用的,我想在 Log4J 行中绘制所述实体的 ToString。

Any idea how to expose a Rest that has a generic entity that I can then paint?知道如何公开具有通用实体的 Rest 我可以绘制吗? I comment on the generic entity because some entities have 40 fields, others 20... and each one with different names.我评论通用实体是因为有些实体有 40 个字段,有些有 20 个……而且每个都有不同的名称。

Thank you very much to all.非常感谢大家。

如果您不将 POJO 的 toString 方法导入日志项目,您将无法知道它们,因此,我建议您创建一个 LogMessage POJO,您可以在日志端点中使用它并让客户端将日志消息转换为此发送时。

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

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