logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pramodh Peddi" <ppe...@IMPRIVATA.com>
Subject SyslogAppender with tcp
Date Mon, 09 Apr 2007 19:50:04 GMT
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.

 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message