use of ch.qos.logback.classic.html.HTMLLayout in project uavstack by uavorg.
the class LogBackHookProxy method figureoutLogConfiguration.
private void figureoutLogConfiguration(Logger Logger, LinkedList<LogProfileInfo> list, String appid) {
Iterator<Appender<ILoggingEvent>> appenders = Logger.iteratorForAppenders();
while (appenders != null && appenders.hasNext()) {
LogProfileInfo logProfileInfo = new LogProfileInfo();
if (appid != null) {
logProfileInfo.setAppId(appid);
}
logProfileInfo.setLogType(LogProfileInfo.LogType.Log4j);
Map<String, String> attributes = new HashMap<String, String>();
attributes.put(LogProfileInfo.ENGINE, "logback");
Appender<ILoggingEvent> appender = appenders.next();
if (!(appender instanceof FileAppender<?>)) {
continue;
}
FileAppender<ILoggingEvent> fileAppender = (FileAppender<ILoggingEvent>) appender;
@SuppressWarnings("rawtypes") LayoutWrappingEncoder encoder = (LayoutWrappingEncoder) fileAppender.getEncoder();
Layout<?> layout = encoder.getLayout();
if (null != layout) {
if (layout instanceof PatternLayout) {
PatternLayout patternLayout = (PatternLayout) encoder.getLayout();
attributes.put(LogProfileInfo.PATTERN, patternLayout.getPattern());
} else if (layout instanceof HTMLLayout) {
attributes.put(LogProfileInfo.PATTERN, "HTMLLayout");
} else if (layout instanceof XMLLayout) {
attributes.put(LogProfileInfo.PATTERN, "XMLLayout");
} else if (layout instanceof TTLLLayout) {
attributes.put(LogProfileInfo.PATTERN, "TTCCLayout");
}
}
logProfileInfo.setFilePath(fileAppender.getFile());
logProfileInfo.setAttributes(attributes);
list.add(logProfileInfo);
}
}
Aggregations