logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kamal Ahmed <KAh...@webMethods.com>
Subject RE: SyslogAppender with tcp
Date Mon, 09 Apr 2007 20:43:09 GMT
Here is the recipe:

   1. Extend the AppenderSkeleton abstract class.

   2. Specify whether your appender requires a layout.

   3. If some properties must be activated simultaneously, do it within the
activateOptions() method.

   4. Implement the close() method. It must set the value of the closed
field to true. Remember to release any resources.

   5. Optionally, specify the default ErrorHandler object to use.

   6. Code the append() method. This method is responsible for appending the
logging events and for calling error handlers if an error occurs.

Basically write your own syslog appender.

Or use XML. Config


-----Original Message-----
From: Pramodh Peddi [mailto:ppeddi@IMPRIVATA.com] 
Sent: Monday, April 09, 2007 3:50 PM
To: log4j-user@logging.apache.org
Subject: SyslogAppender with tcp


I am using log4j for logging and doing syslogging to the localhost using
SyslogAppender. I am NOT using configuration/XML file to specify log4j
settings. I am using java code to provide settings. Things are working
fine except that I want to use tcp while syslogging. I am assuming
default is UDP protocol for syslogging. Is there any way I can specify
log4j to use tcp using java code (not in xml/configuration)? 

This is my current java code for syslog initialization....



    private void initSyslog(){



            PatternLayout layout = new PatternLayout("%d| %c %-6p [%t]:

            SyslogAppender syslogApp = new SyslogAppender(layout,
SyslogAppender. LOG_LOCAL0);//[1]




        }catch(Exception e){

            System.out.println("Unable to configure SyslogAppender");





[1] Should I use different constant/syslogfacility? If so what? 

Is there any other way to make the syslogappender explicitly use tcp?






To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org

View raw message