chopsticks icon indicating copy to clipboard operation
chopsticks copied to clipboard

Call logging.basicConfig on tunnel start

Open lordmauve opened this issue 7 years ago • 1 comments

Chopsticks could call logging.basicConfig() on the remote process, so that logs are sent over stderr.

It could also pickle the current root formatter so that the format of logs printed from the remote side matches that from the local side. (However, this might simply add extra problems).

lordmauve avatar Jul 06 '17 15:07 lordmauve

Hi @lordmauve , I've tried a trivial approach to logging as you mentioned in this issue:

https://github.com/amigrave/chopsticks/commit/a8befcfaff7bc89a1828b5e81816fc5ac86c37a0

I tried to use it a bit but I found this approach to be inconvenient in many ways:

  • no fine control over logging configuration (I guess using logging.config.dictConfig would solve this)
  • desynchronization between stderr stream and RPC channel makes the output order nondeterministic
  • the implementation of the stderr stream for debugging prints one [Host] prefix per line of debug text causing visual garbage
  • date timezone difference between the controller and remote machine is not expected in the logging date output

This is why I propose to add an RPC operation code for logging in order to solve those problems. Before I start working on a PR for this feature I'd like to know if:

  1. you are ok with this proposition?
  2. you might have some recommandations/warnings about this approach?

Thanks !

amigrave avatar Sep 11 '17 08:09 amigrave