I set up a basic python logger that writes to a log file and to stdout. When I run my python program locally, log messages with logging.info appear as expected in the file and in the console. However, when I run the same program remotely via ssh -n user@server python main.py neither the console nor the file show any logging.info messages.
This is the code used to set up the logger:
def setup_logging(model_type, dataset): file_name = dataset + "_" + model_type + time.strftime("_%Y%m%d_%H%M") logging.basicConfig( level=logging.INFO, format="[%(levelname)-5.5s %(asctime)s] %(message)s", datefmt='%H:%M:%S', handlers=[ logging.FileHandler("log/{0}.log".format(file_name)), logging.StreamHandler() ]) I already tried the following things:
Sending a message to
logging.warning: Those appear as expected on the root logger. However, even without setting up the logger and falling back to the defaultlogging.infomessages do not show up.The file and folder permissions seem to be alright and an empty file is created on disk.
Using
printworks as usual as well