[logback-dev] [android] support for SMTPAppender: almost there?

Enrico Spinielli enrico.spinielli at googlemail.com
Mon Feb 6 12:07:17 CET 2012


Hi,
it looks like I am close to be able to add support for SMTPAppender.
I modified the build.xml to include the relevant code, re-introduced the
tests (SocketAppenderTest.class, DilutedSMTPAppenderTest.class,
 SMTPAppender_GreenTest.class) and (properly?) set the bootclasspath
to use the android version of javax.mail (see my previous post on SMTPAppender).
I forked logback-android and pushed my changes in
https://github.com/espinielli/logback-android

It looks like the features I am interested in are ok, since I am
getting only html/htmlLong
test cases failing (see below) and I am not interested in sending html
formatted logs via email.

I will try this version out on my android app soon and provide
feedback on this list.

Of course I will welcome any feedbacks from anyone on what I did, i.e. mistakes,
bugs ... fixes and ideas are welcome too.

Thanks in advance
Bye
Enrico

When I run the tests I get html/htmlLong failing with the following:
    [junit] Testcase: html took 260.281 sec
    [junit] 	Caused an ERROR
    [junit] Unexpected end of file from server Nested exception:
Unexpected end of file from server
    [junit] org.dom4j.DocumentException: Unexpected end of file from
server Nested exception: Unexpected end of file from server
    [junit] 	at org.dom4j.io.SAXReader.read(SAXReader.java:484)
    [junit] 	at org.dom4j.io.SAXReader.read(SAXReader.java:343)
    [junit] 	at
ch.qos.logback.classic.net.SMTPAppender_GreenTest.html(Unknown Source)
    [junit] Nested exception:
    [junit] java.net.SocketException: Unexpected end of file from server
    [junit] 	at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:777)
    [junit] 	at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:640)
    [junit] 	at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:774)
    [junit] 	at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:640)
    [junit] 	at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1195)
    [junit] 	at
com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:677)
    [junit] 	at
com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1315)
    [junit] 	at
com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1252)
    [junit] 	at
com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.startPE(XMLDTDScannerImpl.java:722)
    [junit] 	at
com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.skipSeparator(XMLDTDScannerImpl.java:2069)
    [junit] 	at
com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.scanDecls(XMLDTDScannerImpl.java:2032)
    [junit] 	at
com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.scanDTDExternalSubset(XMLDTDScannerImpl.java:320)
    [junit] 	at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1203)
    [junit] 	at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1090)
    [junit] 	at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1003)
    [junit] 	at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
    [junit] 	at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
    [junit] 	at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
    [junit] 	at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
    [junit] 	at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
    [junit] 	at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
    [junit] 	at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
    [junit] 	at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
    [junit] 	at org.dom4j.io.SAXReader.read(SAXReader.java:465)
    [junit] 	at org.dom4j.io.SAXReader.read(SAXReader.java:343)
    [junit] 	at
ch.qos.logback.classic.net.SMTPAppender_GreenTest.html(Unknown Source)
    [junit]
    [junit] Testcase: htmlLong took 736.286 sec
    [junit] 	Caused an ERROR
    [junit] Unexpected end of file from server Nested exception:
Unexpected end of file from server
    [junit] org.dom4j.DocumentException: Unexpected end of file from
server Nested exception: Unexpected end of file from server
    [junit] 	at org.dom4j.io.SAXReader.read(SAXReader.java:484)
    [junit] 	at org.dom4j.io.SAXReader.read(SAXReader.java:343)
    [junit] 	at
ch.qos.logback.classic.net.SMTPAppender_GreenTest.htmlLong(Unknown
Source)
    [junit] Nested exception:
    [junit] java.net.SocketException: Unexpected end of file from server
    [junit] 	at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:777)
    [junit] 	at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:640)
    [junit] 	at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:774)
    [junit] 	at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:640)
    [junit] 	at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1195)
    [junit] 	at
com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:677)
    [junit] 	at
com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1315)
    [junit] 	at
com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1252)
    [junit] 	at
com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.startPE(XMLDTDScannerImpl.java:722)
    [junit] 	at
com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.skipSeparator(XMLDTDScannerImpl.java:2069)
    [junit] 	at
com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.scanDecls(XMLDTDScannerImpl.java:2032)
    [junit] 	at
com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.scanDTDExternalSubset(XMLDTDScannerImpl.java:320)
    [junit] 	at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1203)
    [junit] 	at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1090)
    [junit] 	at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1003)
    [junit] 	at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
    [junit] 	at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
    [junit] 	at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
    [junit] 	at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
    [junit] 	at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
    [junit] 	at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
    [junit] 	at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
    [junit] 	at
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
    [junit] 	at org.dom4j.io.SAXReader.read(SAXReader.java:465)
    [junit] 	at org.dom4j.io.SAXReader.read(SAXReader.java:343)
    [junit] 	at
ch.qos.logback.classic.net.SMTPAppender_GreenTest.htmlLong(Unknown
Source)

-- 
Enrico Spinielli
"Do Androids dream of electric sheep?"— Philip K. Dick
"Hear and forget; see and remember;do and understand."—Mitchel Resnick
"He who refuses to do arithmetic is doomed to talk nonsense."—John McCarthy


More information about the logback-dev mailing list