gpt4 book ai didi

logging - 减少 Glassfish 原木的线宽

转载 作者:行者123 更新时间:2023-12-02 18:35:30 26 4
gpt4 key购买 nike

有谁知道如何减少 Glassfish 原木上每条线的宽度。它似乎包含很多我不需要的信息。下面是一行的示例。

[#|2012-03-04T16:00:09.537+0000|INFO|oracle-glassfish3.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=94;_ThreadName=Thread-1;|16:00:09,537  INFO MyClassNameThatIsLogging:89 - LogMessageHere

我真正关心的是:

  • 开始的时间 - 尽管甚至没有这么详细 (2012-03-04T16:00:09.537+0000)
  • 日志级别 (INFO)
  • 类名/行号 (MyClassNameThatisLogging:89)
  • 消息 (LogMessageHere)

我不关心这部分

oracle-glassfish3.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=94;_ThreadName=Thread-1;

这是在哪里配置的?

我找到了Install log formater in glassfish ,但似乎有点极端。我真的必须创建自己的记录器吗?

提前致谢

最佳答案

自定义日志处理程序似乎是这里唯一的选择。

glassfish 管理指南详细描述了日志格式:

[#|yyyy-mm-ddThh:mm:ss.SSS-Z|Log Level|ProductName-Version|LoggerName|Key Value Pairs|Message|#]

来自:Glassfish Admin Guide, Log Records

进一步指出:

By default, Oracle GlassFish Server log records are captured in a server log file using the format described in Log Records. However, you may find that you want to log messages to a different location, such as a database or a remote server, or log messages from specific loggers to your own file. This can be done by implementing a custom log handler. This section explains how to add a custom log handler to the Oracle GlassFish Server logging service.

来自:Glassfish Admin Guide, Adding a Custom Logging Handler

This blog post显示了一个示例实现。

关于logging - 减少 Glassfish 原木的线宽,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9556503/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com