in src/main/java/com/aliyun/openservices/log/log4j2/LoghubAppender.java [238:296]
public static LoghubAppender createAppender(
@PluginAttribute("name") final String name,
@PluginElement("Filter") final Filter filter,
@PluginElement("Layout") Layout<? extends Serializable> layout,
@PluginConfiguration final Configuration config,
@PluginAttribute("ignoreExceptions") final String ignore,
@PluginAttribute("project") final String project,
@PluginAttribute("logStore") final String logStore,
@PluginAttribute("endpoint") final String endpoint,
@PluginAttribute("accessKeyId") final String accessKeyId,
@PluginAttribute("accessKeySecret") final String accessKeySecret,
@PluginAttribute("stsToken") final String stsToken,
@PluginAttribute("totalSizeInBytes") final String totalSizeInBytes,
@PluginAttribute("maxBlockMs") final String maxBlockMs,
@PluginAttribute("ioThreadCount") final String ioThreadCount,
@PluginAttribute("batchSizeThresholdInBytes") final String batchSizeThresholdInBytes,
@PluginAttribute("batchCountThreshold") final String batchCountThreshold,
@PluginAttribute("lingerMs") final String lingerMs,
@PluginAttribute("retries") final String retries,
@PluginAttribute("baseRetryBackoffMs") final String baseRetryBackoffMs,
@PluginAttribute("maxRetryBackoffMs") final String maxRetryBackoffMs,
@PluginAttribute("topic") final String topic,
@PluginAttribute("source") final String source,
@PluginAttribute("timeFormat") final String timeFormat,
@PluginAttribute("timeZone") final String timeZone,
@PluginAttribute("mdcFields") final String mdcFields,
@PluginAttribute("timePrecision") final String timePrecision) {
Boolean ignoreExceptions = Booleans.parseBoolean(ignore, true);
int maxBlockMsInt = parseStrToInt(maxBlockMs, 0);
int baseRetryBackoffMsInt = parseStrToInt(baseRetryBackoffMs, 100);
int maxRetryBackoffMsInt = parseStrToInt(maxRetryBackoffMs, 100);
int lingerMsInt = parseStrToInt(lingerMs, 3000);
int batchCountThresholdInt = parseStrToInt(batchCountThreshold, 4096);
int batchSizeThresholdInBytesInt = parseStrToInt(batchSizeThresholdInBytes, 5 * 1024 * 1024);
int totalSizeInBytesInt = parseStrToInt(totalSizeInBytes, 104857600);
int retriesInt = parseStrToInt(retries, 3);
int ioThreadCountInt = parseStrToInt(ioThreadCount, 8);
String pattern = isStrEmpty(timeFormat) ? DEFAULT_TIME_FORMAT : timeFormat;
String timeZoneInfo = isStrEmpty(timeZone) ? DEFAULT_TIME_ZONE : timeZone;
DateTimeFormatter formatter = DateTimeFormat.forPattern(pattern).withZone(DateTimeZone.forID(timeZoneInfo));
TimePrecision precision = parseTimePrecision(timePrecision);
return new LoghubAppender(name, filter, layout, ignoreExceptions, project, logStore, endpoint,
accessKeyId, accessKeySecret, stsToken, totalSizeInBytesInt, maxBlockMsInt, ioThreadCountInt,
batchSizeThresholdInBytesInt, batchCountThresholdInt, lingerMsInt, retriesInt,
baseRetryBackoffMsInt, maxRetryBackoffMsInt, topic, source, formatter, mdcFields, precision);
}