You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by Fred Mora <Fr...@gmail.com> on 2006/03/01 02:51:34 UTC

XMLSocketAppender in log4cxx 0.9.8?

Hello,

I am trying to get a simple C++ program to log using SocketAppender.

The program doesn't do any hard-coded config, it's all in the log4j properties
file. In the config file, I defined a console appender, a file appender and an
XML socket appender.

The console and file appenders work as expected, but the socket appender doesn't
send any data. When I run netcat in listening mode on the port allocated to the
XML socket appender, netcat reports that the socket is opened and closed when
the program runs and exits, but zero bytes are transmitted.

Is there anything wrong in my log4j definition below?

# Forces log4j to display messages while parsing this config file
log4j.debug=true

PATTERN=%d %p %x [%c] - %m%n

# Set root logger level to ALL, appender CONS
log4j.rootLogger=ALL, FILE, CONS

# Define console appender CONS
log4j.appender.CONS=org.apache.log4j.ConsoleAppender
log4j.appender.CONS.layout=org.apache.log4j.PatternLayout
log4j.appender.CONS.layout.ConversionPattern=${PATTERN}

# Define FileAppender FILE.
log4j.appender.FILE=org.apache.log4j.FileAppender
log4j.appender.FILE.File=/logs/log.txt
#log4j.appender.FILE.Append=false

log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=${PATTERN}

#Define an XMLSocketAppender on port 22222, on local host
log4j.appender.SOCK=org.apache.log4j.net.XMLSocketAppender
log4j.appender.SOCK.RemoteHost=localhost
log4j.appender.SOCK.Port=22222
log4j.appender.SOCK.LocationInfo=true