I'm seeing this error in my junit testing. I'm doing log.info(message). Before this call I've attached a UDPAppender (with a "badhost") and removed all other appenders.

/EA

3050 [main] ERROR org.apache.log4j.net.UDPAppender - Could not find address of [badhost].
java.net.UnknownHostException: badhost: badhost
        at java.net.InetAddress.getAllByName0(InetAddress.java:1011)
        at java.net.InetAddress.getAllByName0(InetAddress.java:981)
        at java.net.InetAddress.getAllByName(InetAddress.java:975)
        at java.net.InetAddress.getByName(InetAddress.java:889)
at org.apache.log4j.net.UDPAppender.getAddressByName(UDPAppender.java:227) at org.apache.log4j.net.UDPAppender.activateOptions(UDPAppender.java:122) at com.singingfish.knowledgebase.KBLogger.attachUDPAppender(KBLogger.java: 165)
        at com.singingfish.knowledgebase.KBLogger.<init>(KBLogger.java:96)
at com.singingfish.knowledgebase.KBLogger$KBLoggerFunctionalTest.testMessag eNoServer(KBLogger.java:430)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at junit.framework.TestCase.runTest(TestCase.java:154)
        at junit.framework.TestCase.runBare(TestCase.java:127)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:118)
        at junit.framework.TestSuite.runTest(TestSuite.java:208)
        at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe stRunner.java:436) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRun ner.java:311) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRu nner.java:192)


On Oct 4, 2005, at 1:50 PM, Jacob Kjome wrote:

Quoting [EMAIL PROTECTED]:

I have a question which has likely been answered (sorry, couldn't find
it):  I'm using a UDPAppender so I want to be able to catch exceptions
like UnknownHostException or BindException, but if I do...

log.info("sending UDP message");

and it fails, the Exception is sent to the console, but I'm not able to
catch it in my code.  What is the intended way that I should handle
these types of exceptions?


Log4j should never ever throw exceptions from its public api. What is the
exception?  Please provide the stacktrace.

Jake

Thanks for any help!
/ErikAnthony

p.s.
If there is a wiki or FAQ that I should normally consult (other than
the archive of this user list) that would be really helpful too.
Thanks again!
/EA


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





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

Reply via email to