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);
    LogString::const_iterator iter = str.begin();
    while(iter != str.end()) {
      CharsetEncoder::encode(enc, str, iter, buf);
      out->write(buf, p);
    CharsetEncoder::encode(enc, str, iter, buf);
    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?

View raw message