chooser.setAcceptAllFileFilterUsed(true);
chooser.setDialogTitle("Save Events to XML file...");
chooser.showSaveDialog(parent);
File selectedFile = chooser.getSelectedFile();
XMLLayout layout = new XMLLayout();
LoggingEvent event = null;
PrintWriter out = null;
if (selectedFile != null) {
try {
List v = parent.getCurrentLogPanel().getFilteredEvents();
if (((v != null) && (v.size() == 0)) || (v == null)) {
//no events to save
return;
}
Iterator iter = v.iterator();
out =
new PrintWriter(new BufferedWriter(new FileWriter(selectedFile)));
while (iter.hasNext()) {
event = (LoggingEvent) iter.next();
layout.setLocationInfo(event.getThrowableInformation() != null);
out.write(layout.format(event));
}
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
if (out != null) {