| Method from org.apache.log4j.gui.TextPanelAppender Detail: |
public void append(LoggingEvent event) {
String text = this.layout.format(event);
// Print Stacktrace
// Quick Hack maybe there is a better/faster way?
if (event.throwable!=null) {
event.throwable.printStackTrace(tp);
for (int i=0; i< sw.getBuffer().length(); i++) {
if (sw.getBuffer().charAt(i)=='\t")
sw.getBuffer().replace(i,i+1," ");
}
text += sw.toString();
sw.getBuffer().delete(0,sw.getBuffer().length());
}
else
if(!text.endsWith("\n"))
text += "\n";
logPublisher.publishEvent(event.priority, text);
}
|
public void close() {
}
|
public JPanel getLogTextPanel() {
return logTextPanel;
}
|
public String[] getOptionStrings() {
return new String[] { COLOR_OPTION_FATAL, COLOR_OPTION_ERROR,
COLOR_OPTION_WARN, COLOR_OPTION_INFO, COLOR_OPTION_DEBUG,
COLOR_OPTION_BACKGROUND, FONT_NAME_OPTION, FONT_SIZE_OPTION};
}
|
public boolean requiresLayout() {
return true;
}
|
protected void setLogTextPanel(LogTextPanel logTextPanel) {
this.logTextPanel = logTextPanel;
logTextPanel.setTextBackground(Color.white);
}
|
public void setName(String name) {
this.name = name;
}
|
public void setOption(String option,
String value) {
if (option.equalsIgnoreCase(COLOR_OPTION_FATAL))
logTextPanel.setTextColor(Priority.FATAL,value);
if (option.equalsIgnoreCase(COLOR_OPTION_ERROR))
logTextPanel.setTextColor(Priority.ERROR,value);
if (option.equalsIgnoreCase(COLOR_OPTION_WARN))
logTextPanel.setTextColor(Priority.WARN,value);
if (option.equalsIgnoreCase(COLOR_OPTION_INFO))
logTextPanel.setTextColor(Priority.INFO,value);
if (option.equalsIgnoreCase(COLOR_OPTION_DEBUG))
logTextPanel.setTextColor(Priority.DEBUG,value);
if (option.equalsIgnoreCase(COLOR_OPTION_BACKGROUND))
logTextPanel.setTextBackground(value);
if (option.equalsIgnoreCase(FONT_SIZE_OPTION))
logTextPanel.setTextFontSize(Integer.parseInt(value));
if (option.equalsIgnoreCase(FONT_NAME_OPTION))
logTextPanel.setTextFontName(value);
if (option.equalsIgnoreCase(EVENT_BUFFER_SIZE_OPTION))
logTextPanel.setEventBufferSize(Integer.parseInt(value));
return;
}
|