开发者社区 问答 正文

如何在Java中使用AppErrorMessages类来打印带有参数的错误消息?

如何在Java中使用AppErrorMessages类来打印带有参数的错误消息?

展开
收起
萝卜丝丸子 2024-08-05 21:24:14 68 分享 版权
1 条回答
写回答
取消 提交回答
  • 你可以直接调用AppErrorMessages.message方法,并传入错误码和需要替换到消息中的参数。例如:

    log.info(AppErrorMessages.message("APP-100-400", "xxx@example.com"));
    这将输出类似"APP-100-400 - Failed to log in system with email and password(Email login failed): can not find account with email xxx@example.com --- please refer https://example.com/login/byemail --- Solutions: 1. check your email 2. check your password"的日志信息。
    
    2024-08-05 21:59:47
    赞同 展开评论
问答分类:
问答地址: