Hello,
i want to print out the loginfo from a thread that is triggered in the background.
What i do is:
- Log information in the triggered thread
- Get the logger instance in my UI implementation
- call public void publish() to add the info to a textarea
- use a refresher to scrolldown
- panel and Textarea is setimmediate(true)
The problem is that “logView.setValue(newContent);” sets the value properly… but its not updating the UI. Another thing is that the refresher is not starting from inside the loggHandler.
heres my code:
final Refresher refresher = new Refresher();
refresher.addListener(new RefreshListener() {
@Override
public void refresh(Refresher source) {
processinfoPanel.setScrollTop(1000000);
processinfoPanel.requestRepaint();
source.setRefreshInterval(0);
}
});
final Logger logger = Logger.getLogger(ArchivJob.class.getName());
logger.addHandler(new Handler() {
@Override
public void publish(LogRecord record) {
if (! isLoggable(record))
return;
if (getFormatter() == null)
setFormatter(new SimpleFormatter());
String content = (String) logView.getValue();
String entry = getFormatter().format(record);
String newContent = content + "\n" + entry;
logView.setValue(newContent);
refresher.setRefreshInterval(1000);
}
@Override
public void flush() {
}
@Override
public void close() throws SecurityException {
}
});
addExtension(refresher);
thank you