B4J Question Jserver and Multiple log windows ?

marcick

Well-Known Member
Licensed User
Longtime User
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 ?
 

marcick

Well-Known Member
Licensed User
Longtime User
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 ?
 
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
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.

1634195038087.png
 
Upvote 0

roerGarcia

Active Member
Licensed User
Longtime User
Write the log yo text file
Identify the lines with a prefix "log1", etc
Read the text file
Put the lines in the text box according a log1, log2, etc
 
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
Do you mean this ?

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
 
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
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.
 
Last edited:
Upvote 0

roerGarcia

Active Member
Licensed User
Longtime User
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)
 
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
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.
 
Upvote 0

roerGarcia

Active Member
Licensed User
Longtime User
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.
 
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
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.
 
Upvote 0
Top