简体   繁体   English

如何在 Java 中自定义 logger.info 的日期和时间

[英]How to customize the date and time of logger.info in Java

I'm using:我在用着:

  logger.info(str); 

The output is; output 是;

**Mar 02, 2021 12:01:36 PM** hardwarelog.CustomLogger writeLog
INFO: {"status":true,"message":"success","status_code":200}

The date that gets added is system date and time.添加的日期是系统日期和时间。 I want to remove it and add epoch time instead.我想删除它并添加纪元时间。

How will I do it?我将如何做?

Use AOP to save the log and define a single format for date & time.使用 AOP 保存日志并为日期和时间定义单一格式。

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

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