Charset c = Charset.isSupported("UTF-8") ? Charset.forName("UTF-8") : Charset.defaultCharset();
if (charset != null) {
if (Charset.isSupported(charset)) {
c = Charset.forName(charset);
} else {
LOGGER.error("Charset " + charset + " is not supported for layout, using " + c.displayName());
}
}
boolean includeNewLine = includeNL == null ? false : Boolean.valueOf(includeNL);
Facility f = Facility.toFacility(facility, Facility.LOCAL0);
return new SyslogLayout(f, includeNewLine, c);