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 Jeroen Breedveld <je...@x-hive.com> on 2001/01/31 17:34:40 UTC

Cannot get SyslogAppender to work

Hi all,

I've been trying to get the SyslogAppender with the following code, but no
luck so far:

        cat = Category.getInstance(MyClass.class.getName());
        cat.setPriority(Priority.INFO);
        SimpleLayout layout = new SimpleLayout();
        SyslogAppender appender = new SyslogAppender(layout, "anda", 0);
        cat.addAppender(appender);
        cat.warn("Low fuel level.");

anda is a linux server in our network (not the machine I'm testing from!),
do I have to configure it in a special way to allow syslog messages from
another machine than itself to enter its log?
What's the meaning of that parameter "syslogFacility" in SyslogAppender
constructor?

Many thanks,

jeroen

ps.: I've tried looking similar questions like this but was unable to find
them at www.mail-archives.com (link doesn't even work!)  and
www.geocrawler.com



Re: Cannot get SyslogAppender to work

Posted by Ceki Gülcü <cg...@urbanet.ch>.
At 17:53 31.01.2001 +0100, you wrote:

>----- Original Message -----
>From: "Rex Madden" <re...@microcreditcard.com>
>To: "LOG4J Users Mailing List" <lo...@jakarta.apache.org>
>Sent: Wednesday, January 31, 2001 5:39 PM
>Subject: RE: Cannot get SyslogAppender to work
>
>
>| Not familiar with the syslog, but this is from the javadoc:
>|
>| SyslogHost
>| The host name of the syslog host where log output should go. WARNING If
>the
>| SyslogHost is not set, then this appender will fail.
>|
>|
>| Facility A string representing the syslog facility.
>|
>| Acceptable values are in the set {KERN, USER, MAIL, DAEMON, AUTH, SYSLOG,
>| LPR, NEWS, UUCP, CRON, AUTHPRIV, FTP LOCAL0, LOCAL1, LOCAL2, LOCAL3,
>LOCAL4,
>| LOCAL5, LOCAL6, LOCAL7}.
>|
>
>I tried:
>
>         SyslogAppender appender = new SyslogAppender(layout, "anda",
>SyslogAppender.LOG_LOCAL0);
>
>I'm not sure if LOCAL0 is correct, but I suppose I cannot make my debug
>messages look like messages from the kernel!

Actually you can. Hey, you can even send e-mail as the president of 
Bostwania. :-)

----
Ceki Gülcü - Independent IT Consultant

av. de Rumine 5            Tel: ++41 21 351 23 15
CH-1005 Lausanne        e-mail: cgu@urbanet.ch  or
Switzerland                     ceki_gulcu@yahoo.com


Re: Cannot get SyslogAppender to work

Posted by Jeroen Breedveld <je...@x-hive.com>.
----- Original Message -----
From: "Rex Madden" <re...@microcreditcard.com>
To: "LOG4J Users Mailing List" <lo...@jakarta.apache.org>
Sent: Wednesday, January 31, 2001 5:39 PM
Subject: RE: Cannot get SyslogAppender to work


| Not familiar with the syslog, but this is from the javadoc:
|
| SyslogHost
| The host name of the syslog host where log output should go. WARNING If
the
| SyslogHost is not set, then this appender will fail.
|
|
| Facility A string representing the syslog facility.
|
| Acceptable values are in the set {KERN, USER, MAIL, DAEMON, AUTH, SYSLOG,
| LPR, NEWS, UUCP, CRON, AUTHPRIV, FTP LOCAL0, LOCAL1, LOCAL2, LOCAL3,
LOCAL4,
| LOCAL5, LOCAL6, LOCAL7}.
|

I tried:

        SyslogAppender appender = new SyslogAppender(layout, "anda",
SyslogAppender.LOG_LOCAL0);

I'm not sure if LOCAL0 is correct, but I suppose I cannot make my debug
messages look like messages from the kernel!

I also tried:

        SyslogAppender appender = new SyslogAppender(layout,
"bogushostname", SyslogAppender.LOG_LOCAL0);

this gave me an "java.net.UnknownHostException: bogushostname" so this means
it can actually reach the syslog server.

greetings,

jeroen


|
| Hope it helps,
|
| Rex
|




RE: Cannot get SyslogAppender to work

Posted by Rex Madden <re...@microcreditcard.com>.
Not familiar with the syslog, but this is from the javadoc:

SyslogHost
The host name of the syslog host where log output should go. WARNING If the
SyslogHost is not set, then this appender will fail.


Facility A string representing the syslog facility.

Acceptable values are in the set {KERN, USER, MAIL, DAEMON, AUTH, SYSLOG,
LPR, NEWS, UUCP, CRON, AUTHPRIV, FTP LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4,
LOCAL5, LOCAL6, LOCAL7}.


Hope it helps,

Rex

-----Original Message-----
From: Jeroen Breedveld [mailto:jeroenb@x-hive.com]
Sent: Wednesday, January 31, 2001 11:35 AM
To: log4j-user@jakarta.apache.org
Subject: Cannot get SyslogAppender to work

Hi all,

I've been trying to get the SyslogAppender with the following code, but no
luck so far:

        cat = Category.getInstance(MyClass.class.getName());
        cat.setPriority(Priority.INFO);
        SimpleLayout layout = new SimpleLayout();
        SyslogAppender appender = new SyslogAppender(layout, "anda", 0);
        cat.addAppender(appender);
        cat.warn("Low fuel level.");

anda is a linux server in our network (not the machine I'm testing from!),
do I have to configure it in a special way to allow syslog messages from
another machine than itself to enter its log?
What's the meaning of that parameter "syslogFacility" in SyslogAppender
constructor?

Many thanks,

jeroen

ps.: I've tried looking similar questions like this but was unable to find
them at www.mail-archives.com (link doesn't even work!)  and
www.geocrawler.com



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


Mail archives

Posted by Anders Kristensen <ak...@dynamicsoft.com>.
> 
> The log4j archives are at http://marc.theaimsgroup.com/. Ceki
> 

For MHonArc fans there are also archives at

  http://www.mail-archive.com/log4j-user@jakarta.apache.org/
  http://www.mail-archive.com/log4j-dev@jakarta.apache.org/

--
Anders Kristensen

Re: Cannot get SyslogAppender to work

Posted by Ceki Gülcü <cg...@urbanet.ch>.
Hi Jeroen,

At 17:34 31.01.2001 +0100, you wrote:
>Hi all,
>
>I've been trying to get the SyslogAppender with the following code, but no
>luck so far:
>
>         cat = Category.getInstance(MyClass.class.getName());
>         cat.setPriority(Priority.INFO);
>         SimpleLayout layout = new SimpleLayout();
>         SyslogAppender appender = new SyslogAppender(layout, "anda", 0);
>         cat.addAppender(appender);
>         cat.warn("Low fuel level.");
>
>anda is a linux server in our network (not the machine I'm testing from!),
>do I have to configure it in a special way to allow syslog messages from
>another machine than itself to enter its log?

Yep. You have to enable the linux syslogd to accept messages from the 
network with the -r option.

>What's the meaning of that parameter "syslogFacility" in SyslogAppender
>constructor?

Try "man 3 syslog".

>Many thanks,

You are welcome.

>ps.: I've tried looking similar questions like this but was unable to find
>them at www.mail-archives.com (link doesn't even work!)  and
>www.geocrawler.com

The log4j archives are at http://marc.theaimsgroup.com/. Ceki

----
Ceki Gülcü - Independent IT Consultant

av. de Rumine 5            Tel: ++41 21 351 23 15
CH-1005 Lausanne        e-mail: cgu@urbanet.ch  or
Switzerland                     ceki_gulcu@yahoo.com