Hello,

I'm new to using log4cxx, but the functionality seems very useful - I'm looking for some directions on its uses however...

Is it correct to assume that an external file like log4cxx.properties, or an xml config file is the best way to configure log4cxx? Trying to directly use the class methods for setting up appenders seems problematic for me... I'll be glad to expand if the two approaches are equally usable...

Using the external configuration file, I'm able to get the basic appenders working (file and console), however in trying to get the syslog appender to log to syslogd, I'm not getting anything.

I'm running OS X 10.4.3, and syslogd is running, with user.* being directed to /var/log/user.log

My log4cxx.properties file is as follows:

----
log4j.rootLogger=debug, stdout, syslog, R
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=example.log
log4j.appender.R.MaxFileSize=100KB
# Keep one backup file
log4j.appender.R.MaxBackupIndex=1
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
#try this
log4j.appender.syslog=org.apache.log4j.net.SyslogAppender
log4j.appender.syslog.SyslogHost=localhost
log4j.appender.syslog.Facility=user
log4j.appender.syslog.layout=org.apache.log4j.PatternLayout
log4j.appender.syslog.layout.ConversionPattern=%d{ISO8601} %-5p [%t] % c{1} - %m%n
----

I'm able to use the Unix "logger" utility from the command line and see messages go to /var/log/user.log, however this configuration doesn't log my applications logs to that file. Any help would be appreciated!!!

thanks!
-lev

Reply via email to