I just spent some time finding out, why i could not tell log4j to write log files in UTF-8. I got the error "Error initializing output writer." and "Unsupported encoding?" When debugging into it, i discovered, that it was a UTS fault, as the line in the property file said "log4j.appender.ESP.Encoding=UTF-8 " (note the space at the end). Therefore I'd like to suggest to introduce some string trimming in the method WriterAppend.createWriter(OutputStream). String enc=getEncoding().trim(); or so.
Created attachment 24667 [details] Patch adds trim() to encoding setter This patch adds trimming of the encoding string to the setter method.
I have added trimming to the setter of the encoding property.
The trimming should already be done. Please see PropertySetter class: - snip Object convertArg(String val, Class type) { if(val == null) return null; String v = val.trim(); if (String.class.isAssignableFrom(type)) { return val; - snip Why does this not work for you?
I've just encountered this bug with log4j 1.2.15.