Hi all,

I wanted to create a simple test program to try out the SocketAppender class
in log4j. I decided to use the Chainsaw program to view to log events. I
created 2 appenders, one console appender, and one socket appender. The
socket appender is setup on the same port as chainsaw (in this instance,
1000) and I know this is correct as if I change this port or if I don't
start chainsaw the logging program throws an exception. The messages get
printed to the console, but I see no messages in chainsaw. Currently I'm not
sure if this is a problem with my use of chainsaw, or with my use of log4j,
and I was wondering if someone could take a look at my code and see if I've
made any obvious mistakes?
I get some messages from chainsaw, informing me that its starting to get
data (I assume my messages), but it then reports a SocketException (from
com.puppycrawl.tools.chainsaw.LoggingReciever). I'm guessing this is mist
likely a problem with either chainsaw or my use of it, so will probably
build my own version tonight with some more debug info in it.
If anyone has an alternate Socket display program I could use to see if
Chainsaw is the problem, I'd appreciate it.

code:

public static void main(String args[]) {
Category cat = Category.getInstance(SocketLoggerTester.class.getName());
SocketAppender appender = new SocketAppender("localhost", 1000);
appender.setLayout(new TTCCLayout());
cat.addAppender(appender);
cat.addAppender(new ConsoleAppender(new TTCCLayout()));
BasicConfigurator.configure();
cat.info("Hello!");
try {Thread.sleep(5000);}catch (Exception e){}
cat.info("Bye!");
}

Thanks in advance,

sam


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to