Hello Ceki,

On Thu, Mar 27, 2008 at 4:31 PM, you wrote:

> By character set, I actually meant character encoding, e.g. ASCII, UTF-8.


Oh, I see. Actually, I was addled by your "whereas log4j's implementation
actually counts the number of *bytes* written". Looking into the
org.apache.log4j.helpers.CountingQuietWriter, I have found the following
code:
===
  public
  void write(String string) {
    try {
      out.write(string);
      count += *string.length()*;
    }
    catch(IOException e) {
      errorHandler.error("Write failure.", e, ErrorCode.WRITE_FAILURE);
    }
  }
===
Am I right that it is possible to replace '.length()' with '.getBytes(
suitableCharsetName).length' to be sure in real size (in bytes) of written
string? Can it be faster than calling file.getSize()?

suitableCharsetName can be a system charset or specified by
http://logback.qos.ch/apidocs/ch/qos/logback/core/WriterAppender.html#encoding
-- 
Be Happy!!!
UIN ICQ: 9487080
JUD: [EMAIL PROTECTED]
_______________________________________________
logback-dev mailing list
[email protected]
http://qos.ch/mailman/listinfo/logback-dev

Reply via email to