In my B4J server app, I would like to have more than one log window, each one showing different type of operations.
I know that Jserver must run in a non-UI app. So, how would you do to obtain this ?
1. You can write to multiple files and monitor them with: tail -f logfile.
2. You can create a regular or WebSocket handler for logging and open it with the browser.
Thank you but I need more explicit details to understand .....
when I write log("hello world") how to redirect it to a specifici windows and how to see this window on the server screen ?
not sure it is what I mean ....
I would like to connect to my server with remote desktop as usual and see something like this. Each window is like the non-UI console window but contains each one different type of log strings.
If I could write a Jserver UI app that would be easy using 4 TextArea but I'm reading it is not possible.
1) the server non-UI app continuously write the file and purge it to hold the last n lines
2) a second UI app continuously read the file and redirect properly the strings to separate text box
I wonder if a continuous read/write files operation (in some moments also 10 update in a second) can create problems.
I can try to optimize and reduce the logs at minimum but the traffic is consistent.
I'm looking at ABmaterial also, powerful but probably much more (and heavy) than what I need.
Maybe an cutting operation on the server, like "tail logtextfile -n 20 > logfiletmp" or filtering the log take out only the new text with awk (just an idea)
Now the firsts suggestions are more clear to me.
Maybe a websocket is more efficient to exchange info between the two apps and involve only local network traffic.
Thanks again.
Maybe an cutting operation on the server, like "tail logtextfile -n 20 > logfiletmp" or filtering the log take out only the new text with awk (just an idea)
I think we are assuming that your operating system is type Unix, Linux or something similar, these include the tail command that shows the last "n" lines of a text file.
Another option is to write the log of your application to a database and read it from another that shows the different logs it produces.
ah, ok, no I'm on Windows server 2019.....
I have noted creating a blank B4J server project, it includes a WebSocket sample and I think this is the best solution.
I can keep the log in memory, in a list for example, so I have no files operation.
I just have to learn some HTML to format properly the data in separate TextArea.