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 -Kamal. -----Original Message----- From: Pramodh Peddi [mailto:[EMAIL PROTECTED] Sent: Monday, April 09, 2007 3:50 PM To: [email protected] Subject: SyslogAppender with tcp Hi, 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(){ try{ PatternLayout layout = new PatternLayout("%d| %c %-6p [%t]: %m.%n"); SyslogAppender syslogApp = new SyslogAppender(layout, SyslogAppender. LOG_LOCAL0);//[1] syslogApp.setSyslogHost("localhost"); addAppender(syslogApp); setLevel(Level.DEBUG); }catch(Exception e){ System.out.println("Unable to configure SyslogAppender"); } }//initSyslog ***************** [1] Should I use different constant/syslogfacility? If so what? Is there any other way to make the syslogappender explicitly use tcp? Thanks, -Pramodh. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
