0

I tried to run this command:

$ python flathunt.py >> job.log
[2022/01/16 20:33:49|config.py         |INFO    ]: Using config /home/adam/flathunter/config.yaml

according to my understanding from How do I save terminal output to a file? the output [2022/01/16 20:33:49|config.py |INFO ]: Using config /home/adam/flathunter/config.yaml that was caused by flathunt.py script should have not been printed on the screen but stored in the job.log file. However, the opposite is true, the job.log is empty. What am I missing here?

Adam
  • 2,300
  • 6
  • 33
  • 52
  • Can you try ... `2>>` ...? – FedKad Jan 16 '22 at 19:43
  • @FedKad if use 2>> then I cannot see anything in terminal but its stored in the log file. – Adam Jan 16 '22 at 19:44
  • I am using this script: https://github.com/flathunters/flathunter/blob/main/flathunt.py – Adam Jan 16 '22 at 19:45
  • See [Command output is not redirected to file](https://askubuntu.com/questions/1269712/command-output-is-not-redirected-to-file) – steeldriver Jan 16 '22 at 20:10
  • @steeldriver But in the linked script an info is logged not an error `self.__log__.info` https://github.com/flathunters/flathunter/blob/main/flathunter/config.py#L26 - so this does not answer my question, right? – Adam Jan 16 '22 at 21:40
  • @Adam based on `help(logger)` it looks like the logger object's default handler writes to the error stream regardless of the message level (*"If stream is not specified, sys.stderr is used."*) – steeldriver Jan 16 '22 at 22:33

0 Answers0