You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Pramodh Peddi <pp...@IMPRIVATA.com> on 2007/04/09 21:50:04 UTC
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.
Re: SyslogAppender with tcp
Posted by Curt Arnold <ca...@apache.org>.
On Apr 10, 2007, at 6:09 PM, Pramodh Peddi wrote:
> Curt,
> Thanks for the response. Do you thinking the solution is difficult
> because I am not using XML configuration? Or irrespective of my using
> XML configuration or programmatic configuration, the solution is
> difficult?
>
> Thanks,
>
> -Pramodh.
>
The problem is not related to the configuration method.
org.apache.log4j.net.SyslogAppender is pure java code that only
implements syslog using UDP. If you use a JNI based SyslogAppender
like that in the referenced bug report, you would get all the
features of your platform's implementation of syslog, but at the cost
of using native code.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
RE: SyslogAppender with tcp
Posted by Pramodh Peddi <pp...@IMPRIVATA.com>.
Curt,
Thanks for the response. Do you thinking the solution is difficult
because I am not using XML configuration? Or irrespective of my using
XML configuration or programmatic configuration, the solution is
difficult?
Thanks,
-Pramodh.
-----Original Message-----
From: Curt Arnold [mailto:carnold@apache.org]
Sent: Monday, April 09, 2007 5:59 PM
To: Log4J Users List
Subject: Re: SyslogAppender with tcp
On Apr 9, 2007, at 2:50 PM, Pramodh Peddi wrote:
> 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)?
>
org.apache.log4j.net.SyslogAppender only supports UDP transport as
described in RFC 3164 (http://tools.ietf.org/html/rfc3164). There is
(as far as I can tell) no support in the code for TCP transport of
syslog messages and therefore no easy configuration change that will
switch transports.
I did a quick search on syslog over TCP. Things seem pretty muddled
on the standards front: RFC 3195 (http://tools.ietf.org/html/rfc3195)
doesn't seem to be widely implemented and I'm guessing there are ad-
hoc implementations of syslog over TCP that are implementation
specific. It would be necessary to understand the landscape before
considering accepting a contribution or starting an effort to
implement a different protocol. Unless somebody new wants to jump
in, I think it is unlikely that any of the existing developers would
want to tackle the effort.
If your platform implementation of syslog implements syslog of TCP,
you could consider using a Java Native Interface (JNI) based
SyslogAppender such as the one submitted for bug 27363 (http://
issues.apache.org/bugzilla/show_bug.cgi?id=27363).
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: SyslogAppender with tcp
Posted by Curt Arnold <ca...@apache.org>.
On Apr 9, 2007, at 2:50 PM, Pramodh Peddi wrote:
> 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)?
>
org.apache.log4j.net.SyslogAppender only supports UDP transport as
described in RFC 3164 (http://tools.ietf.org/html/rfc3164). There is
(as far as I can tell) no support in the code for TCP transport of
syslog messages and therefore no easy configuration change that will
switch transports.
I did a quick search on syslog over TCP. Things seem pretty muddled
on the standards front: RFC 3195 (http://tools.ietf.org/html/rfc3195)
doesn't seem to be widely implemented and I'm guessing there are ad-
hoc implementations of syslog over TCP that are implementation
specific. It would be necessary to understand the landscape before
considering accepting a contribution or starting an effort to
implement a different protocol. Unless somebody new wants to jump
in, I think it is unlikely that any of the existing developers would
want to tackle the effort.
If your platform implementation of syslog implements syslog of TCP,
you could consider using a Java Native Interface (JNI) based
SyslogAppender such as the one submitted for bug 27363 (http://
issues.apache.org/bugzilla/show_bug.cgi?id=27363).
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org