Kamal,

 

Thanks for the response. I am pleased to know that one could use TCP
using config.xml. I tried online on how to do this. I couldn't find any
examples. Can you please give me an example configuration of how to use
TCP using config.xml?

 

Thanks,

 

-Pramodh.

 

-----Original Message-----
From: Kamal Ahmed [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 11, 2007 2:03 PM
To: Log4J Users List
Subject: RE: SyslogAppender with tcp

 

Pramodh,

 

My guess would be the initialize() method in Syslog class , and replace
the

usage of DatagramSocket, e.g.

            

            try {

                  this.socket = new DatagramSocket();

 

 

with something similar to the one in SocketAppender, ref:

http://logback.qos.ch/xref/ch/qos/logback/access/net/SocketAppender.html

 

I am not sure, if you really want to rewrite syslogAppender this way,
since,

if you use the config.xml file, you can use TCP (much easier that way)

 

Let me know your thoughts on this...

 

-Kamal.

 

-----Original Message-----

From: Pramodh Peddi [mailto:[EMAIL PROTECTED] 

Sent: Tuesday, April 10, 2007 7:11 PM

To: Log4J Users List

Subject: RE: SyslogAppender with tcp

 

Kamal,

 

Thanks for the response. At which point do I make it to explicitly use

TCP protocol in your recipe/suggestion?

 

Thanks,

 

-Pramodh. 

 

-----Original Message-----

From: Kamal Ahmed [mailto:[EMAIL PROTECTED] 

Sent: Monday, April 09, 2007 4:43 PM

To: Log4J Users List

Subject: RE: SyslogAppender with tcp

 

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]

 

 

---------------------------------------------------------------------

To unsubscribe, e-mail: [EMAIL PROTECTED]

For additional commands, e-mail: [EMAIL PROTECTED]

 

---------------------------------------------------------------------

To unsubscribe, e-mail: [EMAIL PROTECTED]

For additional commands, e-mail: [EMAIL PROTECTED]

 

Reply via email to