publish logger output to textarea

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() {
public void refresh(Refresher source) {

final Logger logger = Logger.getLogger(ArchivJob.class.getName());
logger.addHandler(new Handler() {
public void publish(LogRecord record) {
if (! isLoggable(record))

if (getFormatter() == null)
setFormatter(new SimpleFormatter());

String content = (String) logView.getValue();
String entry = getFormatter().format(record);
String newContent = content + "\n" + entry;


public void flush() {

public void close() throws SecurityException {

thank you

Well, the refresher is the way the client can receive asynchronous updates from the server, so if you disable it, there’s no way, without doing a manual request, that the client can know it should restart the refresher, or anything else that happens on the server for that matter. You have a classic chicken-and-egg problem here. You’ll have to keep the Refresher running continuously, or alternatively use the push functionality in Vaadin 7.1 or some other push mechanism (in which case you don’t need Refresher at all.)

Also, it appears your LogHandler lacks proper synchronization when it updates the logView. This is all right if you know all logging occurs when the Vaadin session is locked by the caller, but it seems awfully fragile even then. Prefer the use of the UI.access() method everywhere you can potentially access a Vaadin UI or session from a background thread.