Re: How to build a hudson/jenkins like live log viewer?
Guys, This works like a charm. I'm using it in in our project. Thanks once again for all your suggestions. Just a minor correction in case you are using a MultiLineLabel for nextLog. While appending Javascript in the onPostProcessTarget method, instead of: use: This is needed because .text() method removes the html formatting (i.e the br tags) added by MultiLineLabel. Cheers. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-build-a-hudson-jenkins-like-live-log-viewer-tp4090224p4659629.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to build a hudson/jenkins like live log viewer?
Hi, Check the source code of these two examples: http://www.wicket-library.com/wicket-examples/ajax/clock http://www.wicket-library.com/wicket-examples/ajax/world-clock For your task you can use MultilineLabel component to show the current content. Just refresh its model with the latest content of the file. This wont be very effective because it will re-deliver the whole file content again and again but it is the most simple way. When you become more acquaint with Wicket you can optimize it by re-delivering just the new stuff that is not already shown in the previous repaint. On Tue, Mar 20, 2012 at 1:55 AM, kiwi.ryu kiwi@gmail.com wrote: Hi, as i mentioned i am new to wicket, can you pls tell me how to call this final code mentioned in this thread? i can't have this in constructor, I need to have this code executed after a file selection. Now how do I add these 2 div's during initialization. I have no idea. please respond ASAP. Thanks in advance -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-build-a-hudson-jenkins-like-live-log-viewer-tp4090224p4487006.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to build a hudson/jenkins like live log viewer?
Hi, as i mentioned i am new to wicket, can you pls tell me how to call this final code mentioned in this thread? i can't have this in constructor, I need to have this code executed after a file selection. Now how do I add these 2 div's during initialization. I have no idea. please respond ASAP. Thanks in advance -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-build-a-hudson-jenkins-like-live-log-viewer-tp4090224p4487006.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to build a hudson/jenkins like live log viewer?
Hi, am working on kind of similar use case to build a log viewer. New to wicket..can you share how would you invoke this code from your wicket class based on user selection of a file? appreciate ur inputs. thank you. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-build-a-hudson-jenkins-like-live-log-viewer-tp4090224p4479107.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to build a hudson/jenkins like live log viewer?
James ; Load the file , set it as value for a label component, then add ajaxtimerbehaviour (or something like that) to keep refreshing the label.. Josh. On Fri, Mar 16, 2012 at 10:26 PM, kiwi.ryu kiwi@gmail.com wrote: Hi, am working on kind of similar use case to build a log viewer. New to wicket..can you share how would you invoke this code from your wicket class based on user selection of a file? appreciate ur inputs. thank you. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-build-a-hudson-jenkins-like-live-log-viewer-tp4090224p4479107.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to build a hudson/jenkins like live log viewer?
Thanks everybody. I finally managed to display the content of an active log file. As mentioned in the earlier responses, all you need is two labels. *Markup*: div id=logData wicket:id=logData/div div id=nextLog wicket:id=nextLog/div *Java*: Create the logData label as you would normally create labels and load the content of the log file. Something like this: private MultiLineLabel createLogData() { return new MultiLineLabel(logData, new LoadableDetachableModelObject() { @Override protected Object load() { try{ return FileUtils.readFiletoString(file); }catch(Exception ex){} return ; } }); } And now the interesting component nextLog. It might look something like this: private Label createNextLog() { Label nextLog = new Label(nextLog, new LoadableDetachableModelObject() { @Override protected Object load() { //use a tailing api like Tailer in commons-io or may be just java.io.RandomAccessFile? return your 'tail' content goes here; } }){ // This is needed because, wicket created dynamic ids for the nextLog component @Override public String getMarkupId(boolean createIfDoesNotExist) { return nextLog; } }; nextLog.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(REFRESH_INTERVAL)) { @Override protected void onPostProcessTarget(AjaxRequestTarget target) { /* * We are doing the following here: * - append the content of nextLog to logData * - remove nextLog * - insert nextLog after logData. */ target.appendJavascript( $('#logData').append('p' + $('#nextLog').text() + '/p'); + $('#nextLog').remove(); + $(\div id='nextLog'\).insertAfter($('#logData'));); } }); nextLog.setOutputMarkupId(true); return nextLog; } Thank you once again for each and everyone who took their time to give your thoughts/suggestions. They were precious and I learned a lot by merely interacting with this wonderful community. On Mon, Nov 21, 2011 at 1:53 PM, James james.eliye...@gmail.com wrote: Thanks Igor. You simplified it to the maximum. On Nov 21, 2011 1:36 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: a much simplified version: div wicket:id=logDatalog contents/div div wicket:id=nextLognext log call/div no panel needed. add self-updating behavior to next log call and in the callback also add target.appendjavascript( $('#logdata).append($('#nextlog).content()); $('#nextlog').remove(); $('#logdata).insertafter($('div id='nextlog')); ) im paraphrasing jquery here, but the is that you repaint the nextog div and add javascript that after the repaint you move its contents to the logdata div, and then empty the nextlog div. of course the nextlog div should be hidden via css -igor On Sun, Nov 20, 2011 at 7:46 PM, Clint Checketts checke...@gmail.com wrote: I'd need to look at Tailer to see how it operates. But here is how I'd try it (it is quick and I don't like the markup, but we'll optimize it later: Create a panel that looks like so (we'll call it LoggingPanel): wicket:panel div wicket:id=logDatalog contents/div div wicket:id=nextLognext log call/div /wicket:panel Add a self updating timer behavior so the panel check the Tailer for output, if there is data, then update the logData label with it, make the nextLog component be another LoggingPanel with a SelfUpdatingTImerBehavior, and stop the timerbehavior on the current panel. Drawbacks are: the divs keep getting nested, so the markup isn't the most beautiful, so setRenderBodyOnly(true) might make it nicer. -Clint On Sun, Nov 20, 2011 at 9:27 PM, James james.eliye...@gmail.com wrote: Thanks Steve. I'll look into the commons-io Tailer. But any idea on how to use this with wicket? On Mon, Nov 21, 2011 at 11:10 AM, Steve Swinsburg steve.swinsb...@gmail.com wrote: I've done something similar to this using the Tailer class from commons-io. cheers, Steve On 21/11/2011, at 12:59 PM, James wrote: Dear wicket community, In a project that I'm working on, I need to build a live log viewer or dynamic log viewer or refreshable log viewer. Much like how hudson/jenkins displays the console output. The idea is to dynamically display the new data added to a log file along with the existing content. How to go about doing this? Please throw some light on this. I searched about this in the web, mailing lists but couldn't
Re: How to build a hudson/jenkins like live log viewer?
On Sun, Nov 20, 2011 at 8:59 PM, James james.eliye...@gmail.com wrote: Dear wicket community, In a project that I'm working on, I need to build a live log viewer or dynamic log viewer or refreshable log viewer. Much like how hudson/jenkins displays the console output. The idea is to dynamically display the new data added to a log file along with the existing content. How to go about doing this? Please throw some light on this. I searched about this in the web, mailing lists but couldn't find what I was looking for, so I'm posting it here. If this is asked elsewhere, kindly re-direct me to the respective resource. I suppose you're only asking about the web UI portion of this application. The service / backend stuff is out of the context of this forum. (Although I would suggest looking at using something like Camel that has all the necessary stuff for monitoring files and file streams and then routing messages through to your application and/or other processors - see [1] below). For the web UI part, there are basically two methods: push, poll 1 - push - using something like cometd, etc to do AJAX push events (really, these are long-pollers, leaving long-running HTTP requests going and processing a stream of events that are received over the life of the connection) 2 - poll - if you have some component that shows the last X lines of a log file, just call component.add(new AjaxSelfUpdatingTimer(someDuration)). As long as you've written your IModel correctly (it always retrieves the most up-to-date data), this will work out of the box [1] http://camel.apache.org/stream.html - and things like scanStream -- Jeremy Thomerson http://wickettraining.com *Need a CMS for Wicket? Use Brix! http://brixcms.org*
Re: How to build a hudson/jenkins like live log viewer?
Jeremy, Thanks for your suggestions. * I suppose you're only asking about the web UI portion of this application.* Yes, I was asking about the web ui portion only. * For the web UI part, there are basically two methods: push, poll* I would like to use the poll method. In fact, I'm trying exactly with the AjaxSelfUpdatingTimer behavior only. The problem is I don't want to display just the last x lines of the log but instead show the current content of the log while adding new content at the bottom. Something like tail -F foo.log. I agree that if I were to display the last x lines, a LoadableDetachableModel implementation with the appropriate logic alone would be sufficient. On Mon, Nov 21, 2011 at 10:51 AM, Jeremy Thomerson jer...@wickettraining.com wrote: On Sun, Nov 20, 2011 at 8:59 PM, James james.eliye...@gmail.com wrote: Dear wicket community, In a project that I'm working on, I need to build a live log viewer or dynamic log viewer or refreshable log viewer. Much like how hudson/jenkins displays the console output. The idea is to dynamically display the new data added to a log file along with the existing content. How to go about doing this? Please throw some light on this. I searched about this in the web, mailing lists but couldn't find what I was looking for, so I'm posting it here. If this is asked elsewhere, kindly re-direct me to the respective resource. I suppose you're only asking about the web UI portion of this application. The service / backend stuff is out of the context of this forum. (Although I would suggest looking at using something like Camel that has all the necessary stuff for monitoring files and file streams and then routing messages through to your application and/or other processors - see [1] below). For the web UI part, there are basically two methods: push, poll 1 - push - using something like cometd, etc to do AJAX push events (really, these are long-pollers, leaving long-running HTTP requests going and processing a stream of events that are received over the life of the connection) 2 - poll - if you have some component that shows the last X lines of a log file, just call component.add(new AjaxSelfUpdatingTimer(someDuration)). As long as you've written your IModel correctly (it always retrieves the most up-to-date data), this will work out of the box [1] http://camel.apache.org/stream.html - and things like scanStream -- Jeremy Thomerson http://wickettraining.com *Need a CMS for Wicket? Use Brix! http://brixcms.org* -- Thanks Regards, James
Re: How to build a hudson/jenkins like live log viewer?
Or should I have two components? One to display the existing content of the log and the other one to display the dynamically added new content..? On Mon, Nov 21, 2011 at 11:07 AM, James james.eliye...@gmail.com wrote: Jeremy, Thanks for your suggestions. * I suppose you're only asking about the web UI portion of this application.* Yes, I was asking about the web ui portion only. * For the web UI part, there are basically two methods: push, poll* I would like to use the poll method. In fact, I'm trying exactly with the AjaxSelfUpdatingTimer behavior only. The problem is I don't want to display just the last x lines of the log but instead show the current content of the log while adding new content at the bottom. Something like tail -F foo.log. I agree that if I were to display the last x lines, a LoadableDetachableModel implementation with the appropriate logic alone would be sufficient. On Mon, Nov 21, 2011 at 10:51 AM, Jeremy Thomerson jer...@wickettraining.com wrote: On Sun, Nov 20, 2011 at 8:59 PM, James james.eliye...@gmail.com wrote: Dear wicket community, In a project that I'm working on, I need to build a live log viewer or dynamic log viewer or refreshable log viewer. Much like how hudson/jenkins displays the console output. The idea is to dynamically display the new data added to a log file along with the existing content. How to go about doing this? Please throw some light on this. I searched about this in the web, mailing lists but couldn't find what I was looking for, so I'm posting it here. If this is asked elsewhere, kindly re-direct me to the respective resource. I suppose you're only asking about the web UI portion of this application. The service / backend stuff is out of the context of this forum. (Although I would suggest looking at using something like Camel that has all the necessary stuff for monitoring files and file streams and then routing messages through to your application and/or other processors - see [1] below). For the web UI part, there are basically two methods: push, poll 1 - push - using something like cometd, etc to do AJAX push events (really, these are long-pollers, leaving long-running HTTP requests going and processing a stream of events that are received over the life of the connection) 2 - poll - if you have some component that shows the last X lines of a log file, just call component.add(new AjaxSelfUpdatingTimer(someDuration)). As long as you've written your IModel correctly (it always retrieves the most up-to-date data), this will work out of the box [1] http://camel.apache.org/stream.html - and things like scanStream -- Jeremy Thomerson http://wickettraining.com *Need a CMS for Wicket? Use Brix! http://brixcms.org* -- Thanks Regards, James -- Thanks Regards, James
Re: How to build a hudson/jenkins like live log viewer?
I've done something similar to this using the Tailer class from commons-io. cheers, Steve On 21/11/2011, at 12:59 PM, James wrote: Dear wicket community, In a project that I'm working on, I need to build a live log viewer or dynamic log viewer or refreshable log viewer. Much like how hudson/jenkins displays the console output. The idea is to dynamically display the new data added to a log file along with the existing content. How to go about doing this? Please throw some light on this. I searched about this in the web, mailing lists but couldn't find what I was looking for, so I'm posting it here. If this is asked elsewhere, kindly re-direct me to the respective resource. -- Thanks Regards, James A happy Wicket user - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to build a hudson/jenkins like live log viewer?
Thanks Steve. I'll look into the commons-io Tailer. But any idea on how to use this with wicket? On Mon, Nov 21, 2011 at 11:10 AM, Steve Swinsburg steve.swinsb...@gmail.com wrote: I've done something similar to this using the Tailer class from commons-io. cheers, Steve On 21/11/2011, at 12:59 PM, James wrote: Dear wicket community, In a project that I'm working on, I need to build a live log viewer or dynamic log viewer or refreshable log viewer. Much like how hudson/jenkins displays the console output. The idea is to dynamically display the new data added to a log file along with the existing content. How to go about doing this? Please throw some light on this. I searched about this in the web, mailing lists but couldn't find what I was looking for, so I'm posting it here. If this is asked elsewhere, kindly re-direct me to the respective resource. -- Thanks Regards, James A happy Wicket user - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Thanks Regards, James
Re: How to build a hudson/jenkins like live log viewer?
I'd need to look at Tailer to see how it operates. But here is how I'd try it (it is quick and I don't like the markup, but we'll optimize it later: Create a panel that looks like so (we'll call it LoggingPanel): wicket:panel div wicket:id=logDatalog contents/div div wicket:id=nextLognext log call/div /wicket:panel Add a self updating timer behavior so the panel check the Tailer for output, if there is data, then update the logData label with it, make the nextLog component be another LoggingPanel with a SelfUpdatingTImerBehavior, and stop the timerbehavior on the current panel. Drawbacks are: the divs keep getting nested, so the markup isn't the most beautiful, so setRenderBodyOnly(true) might make it nicer. -Clint On Sun, Nov 20, 2011 at 9:27 PM, James james.eliye...@gmail.com wrote: Thanks Steve. I'll look into the commons-io Tailer. But any idea on how to use this with wicket? On Mon, Nov 21, 2011 at 11:10 AM, Steve Swinsburg steve.swinsb...@gmail.com wrote: I've done something similar to this using the Tailer class from commons-io. cheers, Steve On 21/11/2011, at 12:59 PM, James wrote: Dear wicket community, In a project that I'm working on, I need to build a live log viewer or dynamic log viewer or refreshable log viewer. Much like how hudson/jenkins displays the console output. The idea is to dynamically display the new data added to a log file along with the existing content. How to go about doing this? Please throw some light on this. I searched about this in the web, mailing lists but couldn't find what I was looking for, so I'm posting it here. If this is asked elsewhere, kindly re-direct me to the respective resource. -- Thanks Regards, James A happy Wicket user - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Thanks Regards, James
Re: How to build a hudson/jenkins like live log viewer?
Clint, Thanks for this idea. Let me give a try to it. Pondering whether the Tailer would introduce any memory leaks if we navigate to a different page. On Mon, Nov 21, 2011 at 11:46 AM, Clint Checketts checke...@gmail.comwrote: I'd need to look at Tailer to see how it operates. But here is how I'd try it (it is quick and I don't like the markup, but we'll optimize it later: Create a panel that looks like so (we'll call it LoggingPanel): wicket:panel div wicket:id=logDatalog contents/div div wicket:id=nextLognext log call/div /wicket:panel Add a self updating timer behavior so the panel check the Tailer for output, if there is data, then update the logData label with it, make the nextLog component be another LoggingPanel with a SelfUpdatingTImerBehavior, and stop the timerbehavior on the current panel. Drawbacks are: the divs keep getting nested, so the markup isn't the most beautiful, so setRenderBodyOnly(true) might make it nicer. -Clint On Sun, Nov 20, 2011 at 9:27 PM, James james.eliye...@gmail.com wrote: Thanks Steve. I'll look into the commons-io Tailer. But any idea on how to use this with wicket? On Mon, Nov 21, 2011 at 11:10 AM, Steve Swinsburg steve.swinsb...@gmail.com wrote: I've done something similar to this using the Tailer class from commons-io. cheers, Steve On 21/11/2011, at 12:59 PM, James wrote: Dear wicket community, In a project that I'm working on, I need to build a live log viewer or dynamic log viewer or refreshable log viewer. Much like how hudson/jenkins displays the console output. The idea is to dynamically display the new data added to a log file along with the existing content. How to go about doing this? Please throw some light on this. I searched about this in the web, mailing lists but couldn't find what I was looking for, so I'm posting it here. If this is asked elsewhere, kindly re-direct me to the respective resource. -- Thanks Regards, James A happy Wicket user - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Thanks Regards, James -- Thanks Regards, James
Re: How to build a hudson/jenkins like live log viewer?
For the backend, I have the Tailer running in a Thread, and keep a reference to it. The you can interrupt the thread as desired by calling thread.interrupt(). Some backend code you might find useful: private Thread thread; public void destroy() { //set the flag to tell our listener to shutdown stopListener(); } public void startListener(File f) { if(thread == null) { //setup the listener and start the thread TailerListener listener = new LogTailListener(); Tailer tailer = new Tailer(f, listener, 1000, true); thread = new Thread(tailer, THREAD_NAME); thread.start(); } } public void stopListener() { thread.interrupt(); } Interested to see your UI when you are done, please share! cheers, Steve On 21/11/2011, at 3:10 PM, James wrote: Clint, Thanks for this idea. Let me give a try to it. Pondering whether the Tailer would introduce any memory leaks if we navigate to a different page. On Mon, Nov 21, 2011 at 11:46 AM, Clint Checketts checke...@gmail.comwrote: I'd need to look at Tailer to see how it operates. But here is how I'd try it (it is quick and I don't like the markup, but we'll optimize it later: Create a panel that looks like so (we'll call it LoggingPanel): wicket:panel div wicket:id=logDatalog contents/div div wicket:id=nextLognext log call/div /wicket:panel Add a self updating timer behavior so the panel check the Tailer for output, if there is data, then update the logData label with it, make the nextLog component be another LoggingPanel with a SelfUpdatingTImerBehavior, and stop the timerbehavior on the current panel. Drawbacks are: the divs keep getting nested, so the markup isn't the most beautiful, so setRenderBodyOnly(true) might make it nicer. -Clint On Sun, Nov 20, 2011 at 9:27 PM, James james.eliye...@gmail.com wrote: Thanks Steve. I'll look into the commons-io Tailer. But any idea on how to use this with wicket? On Mon, Nov 21, 2011 at 11:10 AM, Steve Swinsburg steve.swinsb...@gmail.com wrote: I've done something similar to this using the Tailer class from commons-io. cheers, Steve On 21/11/2011, at 12:59 PM, James wrote: Dear wicket community, In a project that I'm working on, I need to build a live log viewer or dynamic log viewer or refreshable log viewer. Much like how hudson/jenkins displays the console output. The idea is to dynamically display the new data added to a log file along with the existing content. How to go about doing this? Please throw some light on this. I searched about this in the web, mailing lists but couldn't find what I was looking for, so I'm posting it here. If this is asked elsewhere, kindly re-direct me to the respective resource. -- Thanks Regards, James A happy Wicket user - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Thanks Regards, James -- Thanks Regards, James
Re: How to build a hudson/jenkins like live log viewer?
a much simplified version: div wicket:id=logDatalog contents/div div wicket:id=nextLognext log call/div no panel needed. add self-updating behavior to next log call and in the callback also add target.appendjavascript( $('#logdata).append($('#nextlog).content()); $('#nextlog').remove(); $('#logdata).insertafter($('div id='nextlog')); ) im paraphrasing jquery here, but the is that you repaint the nextog div and add javascript that after the repaint you move its contents to the logdata div, and then empty the nextlog div. of course the nextlog div should be hidden via css -igor On Sun, Nov 20, 2011 at 7:46 PM, Clint Checketts checke...@gmail.com wrote: I'd need to look at Tailer to see how it operates. But here is how I'd try it (it is quick and I don't like the markup, but we'll optimize it later: Create a panel that looks like so (we'll call it LoggingPanel): wicket:panel div wicket:id=logDatalog contents/div div wicket:id=nextLognext log call/div /wicket:panel Add a self updating timer behavior so the panel check the Tailer for output, if there is data, then update the logData label with it, make the nextLog component be another LoggingPanel with a SelfUpdatingTImerBehavior, and stop the timerbehavior on the current panel. Drawbacks are: the divs keep getting nested, so the markup isn't the most beautiful, so setRenderBodyOnly(true) might make it nicer. -Clint On Sun, Nov 20, 2011 at 9:27 PM, James james.eliye...@gmail.com wrote: Thanks Steve. I'll look into the commons-io Tailer. But any idea on how to use this with wicket? On Mon, Nov 21, 2011 at 11:10 AM, Steve Swinsburg steve.swinsb...@gmail.com wrote: I've done something similar to this using the Tailer class from commons-io. cheers, Steve On 21/11/2011, at 12:59 PM, James wrote: Dear wicket community, In a project that I'm working on, I need to build a live log viewer or dynamic log viewer or refreshable log viewer. Much like how hudson/jenkins displays the console output. The idea is to dynamically display the new data added to a log file along with the existing content. How to go about doing this? Please throw some light on this. I searched about this in the web, mailing lists but couldn't find what I was looking for, so I'm posting it here. If this is asked elsewhere, kindly re-direct me to the respective resource. -- Thanks Regards, James A happy Wicket user - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Thanks Regards, James - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to build a hudson/jenkins like live log viewer?
Thanks Steve for the code. Igor has almost given all the code we might ever need for the ui part. Clint, I tried your suggestions but it was challenging to start stop the self updating behavoir. On Nov 21, 2011 1:22 PM, Steve Swinsburg steve.swinsb...@gmail.com wrote: For the backend, I have the Tailer running in a Thread, and keep a reference to it. The you can interrupt the thread as desired by calling thread.interrupt(). Some backend code you might find useful: private Thread thread; public void destroy() { //set the flag to tell our listener to shutdown stopListener(); } public void startListener(File f) { if(thread == null) { //setup the listener and start the thread TailerListener listener = new LogTailListener(); Tailer tailer = new Tailer(f, listener, 1000, true); thread = new Thread(tailer, THREAD_NAME); thread.start(); } } public void stopListener() { thread.interrupt(); } Interested to see your UI when you are done, please share! cheers, Steve On 21/11/2011, at 3:10 PM, James wrote: Clint, Thanks for this idea. Let me give a try to it. Pondering whether the Tailer would introduce any memory leaks if we navigate to a different page. On Mon, Nov 21, 2011 at 11:46 AM, Clint Checketts checke...@gmail.com wrote: I'd need to look at Tailer to see how it operates. But here is how I'd try it (it is quick and I don't like the markup, but we'll optimize it later: Create a panel that looks like so (we'll call it LoggingPanel): wicket:panel div wicket:id=logDatalog contents/div div wicket:id=nextLognext log call/div /wicket:panel Add a self updating timer behavior so the panel check the Tailer for output, if there is data, then update the logData label with it, make the nextLog component be another LoggingPanel with a SelfUpdatingTImerBehavior, and stop the timerbehavior on the current panel. Drawbacks are: the divs keep getting nested, so the markup isn't the most beautiful, so setRenderBodyOnly(true) might make it nicer. -Clint On Sun, Nov 20, 2011 at 9:27 PM, James james.eliye...@gmail.com wrote: Thanks Steve. I'll look into the commons-io Tailer. But any idea on how to use this with wicket? On Mon, Nov 21, 2011 at 11:10 AM, Steve Swinsburg steve.swinsb...@gmail.com wrote: I've done something similar to this using the Tailer class from commons-io. cheers, Steve On 21/11/2011, at 12:59 PM, James wrote: Dear wicket community, In a project that I'm working on, I need to build a live log viewer or dynamic log viewer or refreshable log viewer. Much like how hudson/jenkins displays the console output. The idea is to dynamically display the new data added to a log file along with the existing content. How to go about doing this? Please throw some light on this. I searched about this in the web, mailing lists but couldn't find what I was looking for, so I'm posting it here. If this is asked elsewhere, kindly re-direct me to the respective resource. -- Thanks Regards, James A happy Wicket user - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Thanks Regards, James -- Thanks Regards, James
Re: How to build a hudson/jenkins like live log viewer?
Thanks Igor. You simplified it to the maximum. On Nov 21, 2011 1:36 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: a much simplified version: div wicket:id=logDatalog contents/div div wicket:id=nextLognext log call/div no panel needed. add self-updating behavior to next log call and in the callback also add target.appendjavascript( $('#logdata).append($('#nextlog).content()); $('#nextlog').remove(); $('#logdata).insertafter($('div id='nextlog')); ) im paraphrasing jquery here, but the is that you repaint the nextog div and add javascript that after the repaint you move its contents to the logdata div, and then empty the nextlog div. of course the nextlog div should be hidden via css -igor On Sun, Nov 20, 2011 at 7:46 PM, Clint Checketts checke...@gmail.com wrote: I'd need to look at Tailer to see how it operates. But here is how I'd try it (it is quick and I don't like the markup, but we'll optimize it later: Create a panel that looks like so (we'll call it LoggingPanel): wicket:panel div wicket:id=logDatalog contents/div div wicket:id=nextLognext log call/div /wicket:panel Add a self updating timer behavior so the panel check the Tailer for output, if there is data, then update the logData label with it, make the nextLog component be another LoggingPanel with a SelfUpdatingTImerBehavior, and stop the timerbehavior on the current panel. Drawbacks are: the divs keep getting nested, so the markup isn't the most beautiful, so setRenderBodyOnly(true) might make it nicer. -Clint On Sun, Nov 20, 2011 at 9:27 PM, James james.eliye...@gmail.com wrote: Thanks Steve. I'll look into the commons-io Tailer. But any idea on how to use this with wicket? On Mon, Nov 21, 2011 at 11:10 AM, Steve Swinsburg steve.swinsb...@gmail.com wrote: I've done something similar to this using the Tailer class from commons-io. cheers, Steve On 21/11/2011, at 12:59 PM, James wrote: Dear wicket community, In a project that I'm working on, I need to build a live log viewer or dynamic log viewer or refreshable log viewer. Much like how hudson/jenkins displays the console output. The idea is to dynamically display the new data added to a log file along with the existing content. How to go about doing this? Please throw some light on this. I searched about this in the web, mailing lists but couldn't find what I was looking for, so I'm posting it here. If this is asked elsewhere, kindly re-direct me to the respective resource. -- Thanks Regards, James A happy Wicket user - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Thanks Regards, James - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org