logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mykhailo Parfeniuk" <sop...@gmail.com>
Subject XMLSocketAppender fails
Date Wed, 12 Dec 2007 13:17:56 GMT
When I use XMLSocketAppender in my application it fails with assertion
"invalid subscript". The reason is it tries to append zero length string to
output .
When I looked at code I saw strange implementation of function write:

void OutputStreamWriter::write(const LogString& str, Pool& p) {
  if (str.length() > 0) {
    enum { BUFSIZE = 1024 };
    char rawbuf[BUFSIZE];
    ByteBuffer buf(rawbuf, (size_t) BUFSIZE);
    enc->reset();
    LogString::const_iterator iter = str.begin();
    while(iter != str.end()) {
      CharsetEncoder::encode(enc, str, iter, buf);
      buf.flip();
      out->write(buf, p);
      buf.clear();
    }
    CharsetEncoder::encode(enc, str, iter, buf);
    enc->flush(buf);
    buf.flip();
    out->write(buf, p);
  }
}

It seems to me that there should be iterator changing.
Am I right or not?
If use another appenders - file, console, all works normally.
Maybe I forgot initialize something? Or function is implemented incorrectly?

Mime
View raw message