1752679 Members
5291 Online
108789 Solutions
New Discussion юеВ

Toggling xterm logging

 
Raj Kotaru
Occasional Contributor

Toggling xterm logging

Hello All,

I have an application that is running in, and writes to the stdout of an xterm window. I need to create a log of the output from the application.

I am aware that after the application has started, one can enable or disable logging via a mouse click by selecting or deselecting the "log to file" option in the pop down menu.

However, this requires one to have access to the xterm window itself. If I am diailing in via a modem into the machine where my application is already running in an xterm window, is there anay way that I can send a message from the command line that essentially does the same thing as toggling the "log to file" menu item?

I am running HP-UX B.10.20 on a 9000/820 series machine.

Thanks
Raj
5 REPLIES 5
Graham Cameron_1
Honored Contributor

Re: Toggling xterm logging

Are you really running xterm, or is it some other emulator (eg hpterm, dtterm).

I ask because I don't think xterm has logging capability (not on my machine and not in the man page), whereas hpterm and dtterm do.

If hpterm or dtterm, why not just start up logging at invocation time (using "-l -lf logfile") and leave it on ?

-- Graham
Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done.
Elmar P. Kolkman
Honored Contributor

Re: Toggling xterm logging

I have seen ways in the past, but if they still work, it is a security issue...

But it depends on what you want. A way that works is using xwd... You can dump the contents of the hpterm at the time you want the contents. But to get info over a period of time, this will not work.
Every problem has at least one solution. Only some solutions are harder to find.
Mark Grant
Honored Contributor

Re: Toggling xterm logging

well, specifically in the case of a dtterm, it has the default action for all signals. The default action is to terminate so I guess there isn't much you can do apart from the suggestions above.
Never preceed any demonstration with anything more predictive than "watch this"
Rick Beldin
HPE Pro

Re: Toggling xterm logging

xterm logging has been disabled by and large by most vendors.

A better solution would be to modify the command that is running in the xterm window to use the tee command and log all of the application output to a file that you can examine remotely.
You might have to dig around through the apps startup scripts to achieve this. Another optio n might be to modify the application script to use typescript.
Necessary questions: Why? What? How? When?
Raj Kotaru
Occasional Contributor

Re: Toggling xterm logging

Thanks to all those who responded. I did finally find a way to do this.

I used the -lf option to xterm to specify a logfile, except that instead of specifying an actual file name, I specified the endpoint of a pipeline. This can be a shell script to which the output from the xterm window would be piped as input. I wrote the script in the korn shell to utlize the ability to handle signals sent to the script. I used the SIGUSR1 signal to specify to the shell script that its input needs to be logged, and the SIGUSR2 signal to specify that its input no longer needs to be logged.

To send the signals, I used the "kill" command. For example, "kill -SIGUSR1 pid", where pid is the process id of my korn shell script. This seems to work.

Thanks
Raj