Skip to main content

Glassfish Logging to Syslog

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
1 reply [Last post]
push2085
Offline
Joined: 2011-03-18

Hi all,

This is Pushkar. I am trying to get glassfish to log to Syslog and I am not sucessfull in doing the same. I need to know if anyone has success fully done this before and how.

System Info:

Operating System: Linux (CentOS 5.5 64 bit)

Glassfish: glassfish version2.1.1

JDK: jdk1.6.0_21 or up.

Step 1) I Wanted to glassfish to send all the logs to Syslog instead of just to the server.log files. When i was going through the configuration of glassfish logging, i cam across a check box which says

Use UNIX syslog service to produce and manage log messages
I checked this box and then restarted glassfish hoping that this would solve my problem. But this did not work out, It showed me the following problem.

The libutilforsyslog.so is a ELF32 library file

'file' command gives: /opt/glassfish/lib/libutilforsyslog.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), not stripped

I was not able to find a solution to this on glassfish forums as well. So i decided to use log4J and try to use their SyslogAppender to log to syslogs.

Step 2) I downloaded the log4j files and followed the following steps to get it log to syslog.

  1. copy the log4j.jar file to ~/glassfish/lib folder
  2. create a directory called logging inside this lib folder
  3. copy the log4j.xml and log4j.properties file in this folder
  4. the log4j.properties file looks like this:

log4j.rootCategory=syslog

log4j.appender.syslog=org.apache.log4j.net.SyslogAppender
log4j.appender.syslog.syslogHost=<hostname>
log4j.appender.syslog.layout=org.apache.log4j.PatternLayout
log4j.appender.syslog.layout.conversionPattern=[%p] %c:%L - %m%n
log4j.appender.syslog.Facility=local4

5. after this to the Systems Path in glassfish, i added the path to the properties file which is ~/glassfish/lib/logging/

6. I restarted glassfish after this hoping that it will start using the syslog appender to log to syslogs.

Am I doing something wrong? Am I missing something? Is there some one who has achieved this on 64 bit linux and can help me with the same. Also is there some other solution for what i am trying to do.

Any Help is apprecitaed.

Thanks in Advance!!!

Regards,

Pushkar

www.strongauth.com

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
push2085
Offline
Joined: 2011-03-18

Hi all,

I have not posted on this forum for a very very long time, but i did get a way to get glassfish 2.1.1 to send logs to syslog.

I downloaded the glassfish source on my 64 bit machine and just tried building the appserv-native and it created for me a 64 bit libutilforsyslog.so file.

I eplaced the original libutilforsyslog in the glassfish/lib folder and then enabled the
Write to system log
Enabled
Use UNIX syslog service to produce and manage log messages

option and after a reboot glassfish 2.1.1 started logging to syslog