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 Gao Jun <jg...@patternware.com> on 2001/12/03 04:42:26 UTC

Problem in using socketAppender

Hi, all,
     I started to use Log4j a few days ago, it's really cool. But I've met
a problem I don't know whether it is a known bug or I've made soem mistake.
It's like this:
     I run a client process, which will output log to the socketServer appender.
I run a SocketServer to receive these log messages, and I have set the .lcf
file in the server side to make it output to console and file, it works. Then I
wanted to try SMTP appender in the server side, I mean I want to email the
received log message from the cient side out to a third place--the email receiver.
But I failed, I can do this in the first place, I mean, from the client side, email
it out, but I can't do this from the socketServer's place. I don't know why.
Below is the client side lcf and server side lcf. Can anybody answer this 
question?  Thanks.
....
client side .lcf:
# The root category uses the appender called A1. 

log4j.rootCategory=DEBUG, A1

# A1 is set to be a SocketAppender sending its output to the server
running on the local host, port 5000.

log4j.appender.A1=org.apache.log4j.net.SocketAppender
log4j.appender.A1.Port=5000
log4j.appender.A1.RemoteHost=192.168.1.11
.................
server side .lcf:
log4j.rootCategory= , A1, A2
log4j.debug=true

# A1 is set to be ConsoleAppender sending its output to System.out
log4j.appender.A1=org.apache.log4j.ConsoleAppender


# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout

# The conversion pattern consists of date in ISO8601 format, priority,
# thread name, category name truncated to its rightmost two components
# and left justified to 17 characters, location information consisting
# of file name (padded to 13 characters) and line number, nested
# diagnostic context, the and the application supplied message

log4j.appender.A1.layout.ConversionPattern=%d %-5p [%t] %-17c{2} (%13F:%L) %3x - %m%n

log4j.appender.A2=org.apache.log4j.net.SMTPAppender
log4j.appender.A2.To=jgao@patternware.com
log4j.appender.A2.From=jgao@patternware.com
log4j.appender.A2.SMTPHost=smtp.jgao.com
log4j.appender.A2.Subject=testing 
log4j.appender.A2.LocationInfo=true
log4j.appender.A2.layout=org.apache.log4j.PatternLayout

--------------------------------------------
Gao, Jun
patternWare Systems, Inc.
jgao@patternware.com