use of org.apache.sling.commons.log.logback.internal.ConfigSourceTracker.ConfigSourceInfo in project sling by apache.
the class SlingLogPanel method appendLogbackFragments.
private void appendLogbackFragments(final PrintWriter pw, final String consoleAppRoot) {
final Collection<ConfigSourceInfo> configSources = logbackManager.getConfigSourceTracker().getSources();
if (configSources.isEmpty()) {
return;
}
pw.println("<div class='table'>");
pw.println("<div class='ui-widget-header ui-corner-top buttonGroup'>Logback Config Fragments</div>");
pw.println("<table class='nicetable ui-widget'>");
pw.println("<tbody class='ui-widget-content'>");
for (final ConfigSourceInfo ci : configSources) {
final String pid = ci.getReference().getProperty(Constants.SERVICE_ID).toString();
final String url = createUrl(consoleAppRoot, "services", pid);
pw.println("<tr>");
pw.print("<td>");
pw.print(url);
pw.println("</td>");
pw.println("</tr>");
pw.println("<tr>");
pw.println("<td>");
// prettify.js adds a border. We eed to remove that
pw.print("<pre class=\"prettyprint lang-xml\" style=\"border: 0px\">");
pw.print(ci.getSourceAsEscapedString());
pw.print("</pre>");
pw.println("</td>");
pw.println("</tr>");
}
pw.println("</tbody>");
pw.println("</table>");
pw.println("</div>");
}
use of org.apache.sling.commons.log.logback.internal.ConfigSourceTracker.ConfigSourceInfo in project sling by apache.
the class OsgiInternalAction method begin.
@SuppressWarnings("unchecked")
@Override
public void begin(InterpretationContext ec, String name, Attributes attributes) throws ActionException {
ec.addInPlayListener(new ConfigCompleteListener(ec));
populateSubstitutionProperties(ec);
// TO CHECK Should we add the config fragment at end
final Collection<ConfigSourceInfo> providers = getFragmentProviders();
List<SaxEvent> consolidatedEventList = new ArrayList<SaxEvent>();
for (ConfigSourceInfo cp : providers) {
InputSource is = cp.getConfigProvider().getConfigSource();
try {
SaxEventRecorder recorder = new SaxEventRecorder(context);
recorder.recordEvents(is);
// remove the <included> tag from the beginning and </included>
// from the end
trimHeadAndTail(recorder);
consolidatedEventList.addAll(recorder.getSaxEventList());
} catch (JoranException e) {
addError("Error while parsing xml obtained from [" + cp + "]", e);
} finally {
Util.close(is);
}
}
// offset = 2, because we need to get past this element as well as the
// end element
ec.getJoranInterpreter().getEventPlayer().addEventsDynamically(consolidatedEventList, 2);
}
Aggregations