Yes, "count += string.length()" statement could be replaced by "count +=
string.getBytes(encoding).length" which would probably be faster than calling
file.getSize.
However, given that size based rolling policy is less popular then date based
rollovers, I am inclined to just ignore the issue (of performance).
Maverick Crank GRey wrote:
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] <mailto:[EMAIL PROTECTED]>
------------------------------------------------------------------------
_______________________________________________
logback-dev mailing list
[email protected]
http://qos.ch/mailman/listinfo/logback-dev
--
Ceki Gülcü
QOS.ch is looking to hire talented developers in Switzerland. If
interested, please contact c e k i @ q o s . c h
_______________________________________________
logback-dev mailing list
[email protected]
http://qos.ch/mailman/listinfo/logback-dev