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 Joni Hahkala <jo...@cern.ch> on 2006/11/09 19:03:42 UTC

Syslog logging configuration

Hi,

I'm trying to log to syslog, but I can't get it to work.

Bought the manual, but it doesn't say anything, and googling for it I 
only found one example in the manual review.

So, I'm trying with configuration:

log4j.logger.org.glite.security=DEBUG, syslog

log4j.appender.syslog=org.apache.log4j.net.SyslogAppender
log4j.appender.syslog.layout=org.apache.log4j.PatternLayout
log4j.appender.syslog.SyslogHost=localhost
log4j.appender.syslog.Facility=KERN
log4j.appender.syslog.threshold=DEBUG

# define the pattern of the messages
log4j.appender.syslog.layout.ConversionPattern=%d{ISO8601} %-5p [%t] 
%c{2} %x - %m%n


And the log4 debug log shows:

log4j: Trying to find [log4j.properties] using 
ClassLoader.getSystemResource().
log4j: Could not find resource: [null].
log4j: Could not find root logger information. Is this OK?
log4j: Parsing for [org.glite.security] with value=[DEBUG, syslog].
log4j: Level token is [DEBUG].
log4j: Category org.glite.security set to DEBUG
log4j: Parsing appender named "syslog".
log4j: Parsing layout options for "syslog".
log4j: Setting property [conversionPattern] to [%d{ISO8601} %-5p [%t] 
%c{2} %x - %m%n].
log4j: End of parsing for "syslog".
log4j: Setting property [facility] to [KERN].
log4j: Setting property [syslogHost] to [localhost].
log4j: Setting property [threshold] to [DEBUG].
log4j: Parsed "syslog" options.
log4j: Handling log4j.additivity.org.glite.security=[null]
log4j: Finished configuring.

But nothing ends up in the syslog.

I'm using log4j 1.2.8 on Redhat Enterprise Linux 3 compatible system.

Maybe it is something easy that I'm missing, but I'm trying to avoid 
going into the source code and debugging. So, if somebody has any advice 
or experience, any help would be appreciated.

Thanks,
Joni

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


Re: Syslog logging configuration

Posted by Joni Hahkala <jo...@cern.ch>.
Thanks Maarten and Ceki!

Works now, I just didn't fully realize that I had to enable remote 
logging for it to work. And of course with UDP you don't get any error 
messages if there is a problem in the message receiving...

I hope there will be documentation for the SyslogAppender configuration 
values somewhere. :)

Cheers,
Joni

Ceki Gülcü wrote:
> At 10:12 PM 11/9/2006, you wrote:
>> I vaguely remember that we had security issues when we started using the
>> SyslogAppender. Make sure you have the privileges to connect to it via a
>> socket.
>>
>> Most C/C++ apps use the syslog system call, but I believe log4j uses a 
>> TCP
>> socket
>> to talk to the syslog daemon.
> 
> No, I can authoritatively state that log4j uses UDP.
> 
> You have to enable the syslog deamon to accept network (remote) 
> connections. (It's the -r flag for the vanilla syslog daemon. For 
> syslogng you need to open a UDP channel.
> 
> HTH,
> 
> 

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


Re: Syslog logging configuration

Posted by Ceki Gülcü <li...@qos.ch>.
At 10:12 PM 11/9/2006, you wrote:
>I vaguely remember that we had security issues when we started using the
>SyslogAppender. Make sure you have the privileges to connect to it via a
>socket.
>
>Most C/C++ apps use the syslog system call, but I believe log4j uses a TCP
>socket
>to talk to the syslog daemon.

No, I can authoritatively state that log4j uses UDP.

You have to enable the syslog deamon to accept network (remote) 
connections. (It's the -r flag for the vanilla syslog daemon. For syslogng 
you need to open a UDP channel.

HTH,


-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch


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


Re: Syslog logging configuration

Posted by Maarten Bosteels <mb...@gmail.com>.
I vaguely remember that we had security issues when we started using the
SyslogAppender. Make sure you have the privileges to connect to it via a
socket.

Most C/C++ apps use the syslog system call, but I believe log4j uses a TCP
socket
to talk to the syslog daemon.

Maarten

On 11/9/06, Joni Hahkala <jo...@cern.ch> wrote:
>
> Hi,
>
> I'm trying to log to syslog, but I can't get it to work.
>
> Bought the manual, but it doesn't say anything, and googling for it I
> only found one example in the manual review.
>
> So, I'm trying with configuration:
>
> log4j.logger.org.glite.security=DEBUG, syslog
>
> log4j.appender.syslog=org.apache.log4j.net.SyslogAppender
> log4j.appender.syslog.layout=org.apache.log4j.PatternLayout
> log4j.appender.syslog.SyslogHost=localhost
> log4j.appender.syslog.Facility=KERN
> log4j.appender.syslog.threshold=DEBUG
>
> # define the pattern of the messages
> log4j.appender.syslog.layout.ConversionPattern=%d{ISO8601} %-5p [%t]
> %c{2} %x - %m%n
>
>
> And the log4 debug log shows:
>
> log4j: Trying to find [log4j.properties] using
> ClassLoader.getSystemResource().
> log4j: Could not find resource: [null].
> log4j: Could not find root logger information. Is this OK?
> log4j: Parsing for [org.glite.security] with value=[DEBUG, syslog].
> log4j: Level token is [DEBUG].
> log4j: Category org.glite.security set to DEBUG
> log4j: Parsing appender named "syslog".
> log4j: Parsing layout options for "syslog".
> log4j: Setting property [conversionPattern] to [%d{ISO8601} %-5p [%t]
> %c{2} %x - %m%n].
> log4j: End of parsing for "syslog".
> log4j: Setting property [facility] to [KERN].
> log4j: Setting property [syslogHost] to [localhost].
> log4j: Setting property [threshold] to [DEBUG].
> log4j: Parsed "syslog" options.
> log4j: Handling log4j.additivity.org.glite.security=[null]
> log4j: Finished configuring.
>
> But nothing ends up in the syslog.
>
> I'm using log4j 1.2.8 on Redhat Enterprise Linux 3 compatible system.
>
> Maybe it is something easy that I'm missing, but I'm trying to avoid
> going into the source code and debugging. So, if somebody has any advice
> or experience, any help would be appreciated.
>
> Thanks,
> Joni
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>