本文介绍了Glassfish到Syslog的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力使Glassfish 3.1.1登录到syslog,但我无法这样做.我不知道这是否是错误,但我什至不知道如何调试它.

I'm struggling to make Glassfish 3.1.1 to log to syslog, but I'm unable to. I don't know if it's a bug, but I don't even know how to debug it.

第一步,也是显而易见的一步:我选中了管理控制台上的框以写入系统日志,然后还标记了复选框写入系统控制台".他们都没有工作.

First and obvious step: I checked the box on the administration console to write to system log, and after I also marked the checkbox write to system console. None of them worked.

我检查了logging.properties,并且此行在那里

I checked the logging.properties and this line is there

com.sun.enterprise.server.logging.SyslogHandler.useSystemLogging=true

Google搜寻时,我发现一些人抱怨遗弃的问题.还有什么我应该做的,还是我必须编写一个自定义日志处理程序才能做到这一点?

Googling I found a few people complaining with abandoned questions. Is there anything else I should do or I have to write a custom log handler to do that ?

推荐答案

自GF 2.1使用本地库"libutilforsyslog.so"以来,与syslog的连接已更改.在我看来,您现在必须在localhost上提供UDP端口514才能通过GlassFish 3接收系统日志消息.

The connection to syslog has changed since GF 2.1 where a native library "libutilforsyslog.so" was used. Seems to me you now have to provide UDP port 514 on localhost to receive syslog messages by GlassFish 3.

com.sun.enterprise.server.logging.SyslogHandler创建这样的syslog实例:

com.sun.enterprise.server.logging.SyslogHandler creates an syslog instance like this:

sysLogger = new Syslog("localhost");  //for now only write to this host

...是com.sun.enterprise.server.logging.Syslog的实例.此类构建了一个UDP数据报,该数据报被发送到端口514(硬编码).

... which is an instance of com.sun.enterprise.server.logging.Syslog. This class builds a UDP datagram that gets sent to port 514 (hardcoded).

我在运行GlassFish的Debian主机上有syslog-ng软件包. syslog-ng配置了默认的本地日志src:

I have the syslog-ng package on my Debian host on which I run GlassFish. syslog-ng is configured with a default local log src:

source s_src { unix-dgram("/dev/log"); internal();
             file("/proc/kmsg" program_override("kernel"));
};

在此示例中,您可以简单地为UDP端口514添加一个侦听器:

In this example you can simply add a listener for UDP port 514:

udp(ip(127.0.0.1) port(514)); 

这篇关于Glassfish到Syslog的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 22:02