-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/sc tail #208
base: main
Are you sure you want to change the base?
Feature/sc tail #208
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to the review comment, please :
- Update the README with the new command/usage
- Create an issue to track the creation of the man page for the new command (or include those changes in this PR)
echo "No log file found for service $SERVICE" | ||
exit 1 | ||
fi | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took another look at the mainline sc code and realize we need to account for the case where sc loginfo
provides one or more spooled files
ServiceCommander-IBMi/src/main/java/jesseg/ibmi/opensource/OperationExecutor.java
Line 614 in 7917211
m_logger.println(m_mainService.getName() + ": " + StringUtils.colorizeForTerminal(splf, ColorSchemeConfig.get("INFO"))); |
As far as I know, there's no already-made utility for displaying spooled files in a terminal, and definitely nothing analagous to tail -f
. Some ideas:
- Just say something like "unable to tail files, here's the spooled files you can look at, though"
- Build a utility to display spooled files in a terminal. If so, would we include it in SC ? Some other package?
- run the SQL for SYSTOOLS.SPOOLED_FILE_DATA() through
db2util
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I know, there's no already-made utility for displaying spooled files in a terminal
There is the QSHELL catsplf command, which can be run from PASE environment like this:
qsh -c "catsplf -j 123456/USER/JOB <spoolfilename> <spoolfilenumber>"
But I don't know if it's to cumbersome?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chrjorgensen, cool! I think we should use that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to add support for "tailing" spool files. What would be the best way to configure a service that creates spool files to test this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
found splf documentation 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By design, I can only view the spool file if the service has stopped (per quickstart demo). If I call catsplf
on a running service I get the following output:
catsplf: 001-2003 Error CPF3482 found processing spool file QPRINT, number 1.
but once the service is stopped, I can no longer view the DSPSPLF
command from loginfo
. sctail
works great on running services, since we can access the log file via existing sc
commands. In the spool file case, we would need to track the qualified job of the service which would require changing the sc base code unless there is another way to get that service information
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ajshedivy Spool files have (and always have had) the problem that the output is written in blocks and the latest output can not be seen until that block has finished and another block is created. Your problem is the same as when the `DSPSPLF´ command is used - or when the SYSTOOLS.SPOOLED_FILE_DATA() is used.
This makes spool files unsuitable for logs IMHO... writing to streamfiles is much better!
@ThePrez Do you know if it's possible to redirect spool output to a streamfile, while the spool file is open? If not, then I don't think a tail
option for spool files can be done...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chrjorgensen I don't think so, while the splf is still open :(
Explain the reasoning for this pull request. For instance, is it for a new feature, bug fix, code style/cleanup, or something else? If fixing an open issue, please link to it here.
Add wrapper script for getting live tail of current service. Here is an example command line call for getting the tail of a log file:
Any additional comments/context?
TODO:
sc
command-f
optional argument)