command line option to open in existing session

If you think LogMX needs a new useful feature!
Post Reply
jpierce
Posts: 51
Joined: Thu Mar 21, 2019 3:51 pm

command line option to open in existing session

Post by jpierce »

I'd like a command line option to open a log(s) in an existing session of LogMX. I generally don't want to start a new window every time I open a log. If there are multiple sessions, I guess it could either randomly pick one or pick the one that was most recently active.
jpierce
Posts: 51
Joined: Thu Mar 21, 2019 3:51 pm

Re: command line option to open in existing session

Post by jpierce »

And by "session", I just mean currently running instance of the application.
admin
Site Admin
Posts: 555
Joined: Sun Dec 17, 2006 10:30 pm

Re: command line option to open in existing session

Post by admin »

Hello,

You're right, that's indeed something that would be really useful. Sadly, it's not trivial because of the cross-platform constraints. We have a lot of Windows and macOS users, but also Linux. It is not something that is supported by the Java platform for now (but might be later, since the last versions brought a lot of cross-platform "Desktop" features), and not easy to implement/integrate with native code (e.g. on Windows, DLL that would communicate with the Java Virtual Machine).

The feature request that has been in our backlog for many years is to re-use the existing LogMX window when a local log file is opened through the Windows Explorer contextual menu (i.e. right-click on a file > Open with LogMX). Your idea is a new (good) one, but would require the same OS native integration. I increased the priority of this feature, we will check if Java now offers some features that would help doing this without having to integrate native code.

Thank you
Xavier
jpierce
Posts: 51
Joined: Thu Mar 21, 2019 3:51 pm

Re: command line option to open in existing session

Post by jpierce »

Bummer, but as a programmer I get the issue.
jpierce
Posts: 51
Joined: Thu Mar 21, 2019 3:51 pm

Re: command line option to open in existing session

Post by jpierce »

I had an idea on this. The first LogMX could open a specific listener port. Subsequent LogMXs would try to listen on that port and fail. When that happens, they would open a connection to that port and send a message that says "open this file(s)". Then the subsequent LogMX would exit.

That could be done in a very cross-platform way. What do you think? The obvious flaw would be if there was another program already on that port. But it could be configurable in LogMX, and if it can't get an affirmative "yes, I'm LogMX" from connecting to that port, it would just open as normal.

It might have to be an option in LogMX ("always open log files in the same window") rather than a command-line switch.
admin
Site Admin
Posts: 555
Joined: Sun Dec 17, 2006 10:30 pm

Re: command line option to open in existing session

Post by admin »

Hello,

Thanks, that's a good idea, I like it :) I guess if LogMX listens to a local/loopback interface, there shouldn't be any firewall issue. I also wonder if there could be any performance hit when the port is already used by another process (could be LogMX or other). If it takes a short timeout (e.g. a few seconds to fail), it means it will take a few seconds to open new logs in an existing LogMX window. Worth a try...

Also, we could write the last used port number in a temp file, so that would help to easily get an available port number every time, potentially different every time.

Thanks, I'm adding this to our backlog!
jpierce
Posts: 51
Joined: Thu Mar 21, 2019 3:51 pm

Re: command line option to open in existing session

Post by jpierce »

Great to hear.

It's more complex, but you could have the port listener be in a totally different thread, so that it doesn't slow down the main process. It could just message back to the main process when a request comes in on the port.
Post Reply