减少glassfish日志的线宽 [英] Reducing line width of glassfish log

查看:127
本文介绍了减少glassfish日志的线宽的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道我可以如何减少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信息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;

在哪里配置?



我发现在glassfish中安装日志formater ,但它似乎有点极端。我真的必须创建自己的记录器吗?



提前致谢

解决方案

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



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

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

发件人: Glassfish管理员指南,日志记录



进一步说明:


默认情况下,Oracle GlassFish Server日志记录使用日志记录中描述的格式捕获到服务器日志文件中。但是,您可能会发现要将消息记录到其他位置(例如数据库或远程服务器),或将特定记录器的消息记录到自己的文件中。这可以通过实现一个自定义日志处理程序来完成。本节介绍如何将自定义日志处理程序添加到Oracle GlassFish Server日志记录服务。


发件人: Glassfish管理员指南,添加自定义日志处理器



此博文显示了一个示例实现。


Does anyone know how I can reduce the width of each line on a glassfish log. It seems to contain lots of information that I do not need. Below is an example of one line.

[#|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

All I really care about is:

  • the time at the beginning - although not even in this much deatail (2012-03-04T16:00:09.537+0000)
  • the log level (INFO)
  • The classname/line number (MyClassNameThatisLogging:89)
  • The message (LogMessageHere)

I dont care about this part

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

Where is this configured?

I have found Install log formater in glassfish, but it seems a bit extreme. Do I really have to create my own logger?

Thanks in advance

解决方案

A custom log handler seems to be the only option here.

The glassfish admin guide does describes the log format in detail:

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

From: Glassfish Admin Guide, Log Records

Further on it states:

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.

From: Glassfish Admin Guide, Adding a Custom Logging Handler

This blog post shows an example implementation.

这篇关于减少glassfish日志的线宽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆