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 Ma...@americancentury.com on 2002/09/09 18:11:24 UTC

SMTPAppender with VisualAge for Java

I am wondering if anyone has configured an SMTPAppender using IBM's
VisualAge for Java IDE.  If you have, could you provide some tips on how
you did it?

We are using VAJ 4.0 and Log4J 1.2.3.  We are also using a modified version
of the "IBM XML Parser for Java" project which does not include the
org.w3c.dom, org.xml.sax, or org.xml.sax.helpers packages.  We did this so
we could use Xerces 2.1.0 instead of the outdated XML packages included
with VAJ.

Below is the output I am getting when I run my SMTPAppenderTester program.
Maybe this will help you understand the problem I am having.

log4j:ERROR Could not find [log4j.dtd]. Used
[sun.misc.Launcher$AppClassLoader@3346] class loader in the search.
log4j:ERROR Could not parse input source [org.xml.sax.InputSource@6d54].
java.net.MalformedURLException: no protocol: log4j.dtd
      java.lang.Throwable(java.lang.String)
      java.lang.Exception(java.lang.String)
      java.io.IOException(java.lang.String)
      java.net.MalformedURLException(java.lang.String)
      java.net.URL(java.net.URL, java.lang.String,
java.net.URLStreamHandler)
      java.net.URL(java.net.URL, java.lang.String)
      java.net.URL(java.lang.String)
      void
org.apache.xerces.impl.XMLEntityManager.startEntity(java.lang.String,
org.apache.xerces.xni.parser.XMLInputSource, boolean, boolean)
      void
org.apache.xerces.impl.XMLEntityManager.startDTDEntity(org.apache.xerces.xni.parser.XMLInputSource)
      void
org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(org.apache.xerces.xni.parser.XMLInputSource)
      boolean
org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(boolean)
      boolean
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(boolean)
      boolean org.apache.xerces.parsers.DTDConfiguration.parse(boolean)
      void
org.apache.xerces.parsers.DTDConfiguration.parse(org.apache.xerces.xni.parser.XMLInputSource)
      void
org.apache.xerces.parsers.XMLParser.parse(org.apache.xerces.xni.parser.XMLInputSource)
      void
org.apache.xerces.parsers.DOMParser.parse(org.xml.sax.InputSource)
      org.w3c.dom.Document
org.apache.xerces.jaxp.DocumentBuilderImpl.parse(org.xml.sax.InputSource)
      void
org.apache.log4j.xml.DOMConfigurator.doConfigure(org.xml.sax.InputSource,
org.apache.log4j.spi.LoggerRepository)
      void
org.apache.log4j.xml.DOMConfigurator.doConfigure(java.io.InputStream,
org.apache.log4j.spi.LoggerRepository)
      void
org.apache.log4j.xml.DOMConfigurator.doConfigure(java.lang.String,
org.apache.log4j.spi.LoggerRepository)
      void org.apache.log4j.xml.DOMConfigurator.configure(java.lang.String)
      void m7b.test.logging.SMTPAppenderTester.main(java.lang.String [])

log4j:WARN No appenders could be found for logger
(m7b.test.logging.SMTPAppenderTester).
log4j:WARN Please initialize the log4j system properly.

Here's my configuration file.

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<!-- ========================================================== -->
<!-- Sample SMTPAppender configuration using the PatternLayout  -->
<!-- ========================================================== -->
<log4j:configuration debug="true" xmlns:log4j
='http://jakarta.apache.org/log4j/'>
  <appender name="EMAIL" class="org.apache.log4j.net.SMTPAppender">
    <param name="SMTPHost" value="[not shown here]"/>
    <param name="To" value="m7b@americancentury.com"/>
    <param name="From" value="m7b@americancentury.com"/>
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d %-5p %c - %m%n"/>
    </layout>
  </appender>
  <root>
    <level value ="debug"/>
    <appender-ref ref="EMAIL" />
  </root>
</log4j:configuration>

Thank you very much.  I appreciate your time.

Matthew Bennett, Sr. Programmer/Analyst
IT Department
American Century Services Corporation
m7b@americancentury.com
816-340-3577




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>