Open spg opened 7 years ago
There is a request for a way to log messages in the parent process: Issue #60, that we're still looking at.
For my own use I currently use my own logging to record data from the child processes.
Hi @pfifer I am using kcl python for developing my consumer, i need to change the log levels. thats being dumped on the console when i run the program using command amazon_kclpy_helper.py --print_command --java <path-to-java> --properties samples/sample.properties
can you please help?
hey did you found a work around for that? how can I log the KCL client to a file?
We've had really good success with logging with the KCL by using a Python script that wraps the whole thing. It essentially does this:
tail -f
on that log file, and piping its output to stderrRunning it this way, we essentially join the log streams of the KCL and our python logger. It's working really well for us.
For debugging, we use rpdb with a randomly selected (and logged) port.
so @jtfalkenstein you're executing the java kcl app from a python script. that runs you record processor python script?
Yeah. I use a python script to run a couple subprocesses, one of them is the KCL Java Pp and the other is a tail -f that watches the log file where I know it will be. In so doing, I can pipe the log file to stderr and the KCL output to stdout (or plain squelch the KCL output, since it is VERY chatty). This means the python process logs everything as you'd expect and if you didn't look at the code, you'd never know it was streaming logs with a rotating file handler. It has proved to be very stable for us.
Looking at
RecordProcessor::process_records
I see that any exception raised in the
try
block will be written to stderr. However, the stderr buffer is not flushed immediately. In consequence, error messages are not displayed in the MultiLangDaemon's stdout, making debugging harder.In your opinion, what would be the best solution to this problem? Here are some ideas:
executableName = python -u myscript.py
)modify
RecordProcessor
so that it usesamazon_kclpy.kcl._IOHandler
, e.g.:MyCustomRecordProcessor
at theprocess_record
level: