java - Redirecting log output to HTML text area -


i in process of writing web application using jsp , have logging setup being written file during app's running lifetime. log information in case important user , display somehow. @ first thought of using kind of actionlistener on logger object , using scriptlet inside jsp append text text area element i'm not quite sure if work. there easy or known way this? feedback , appreciated. right using regular apache logger object open using outside libraries such log4j or other options achieve need.

am not able this? text area need updated without refreshing whole page each time there info written logger. if not able done, popup processing advisable? done popup, perhaps jswing may ugly.

have considered doing simple periodic ajax polling? here small example using jquery posts jsp , calls javascript function update textarea:

function dopoll(){     $.post('ajax/log.jsp', function(data) {         updatetextarea(data);  // process results here         settimeout(dopoll,5000);     }); } 

a simple maybe quite blut possibility have controller read produced logfile when ajax posts , return latest changes (or whole log).

edit: developerwjk bit faster :) if log important, keep somewhere in database. in post retrieve log messages , pass them ajax.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -