I am test running python Script in Docker Container on Ubuntu Web Server. I am trying to find the Log file generated by Python Logger Module. Below is my Python Script
import time
import logging
def main():
logging.basicConfig(filename="error.log", level=logging.DEBUG)
start_time = time.time()
logging.debug("Program starts running at %d", start_time)
i = 0
while i < 1000:
print(i)
i += 1
while_time = time.time() - start_time
logging.debug("Program ends running at %d", while_time)
start_time = time.time()
logging.debug("Program starts running at %d", start_time)
for x in range(0, 100):
print(x)
if_time = time.time() - start_time
print('While took - %s Seconds' % while_time )
print('If took - %s Seconds' % if_time )
logging.debug("Program ends running at %d", start_time)
main()
I have searched and found that Docker file produces Log file in json format in /var/lib/docker/container/{con_id}/{con_id}.log
This log file only includes the stdout and I cannot find the Log file generated by Python. Is there any way to retrieve the file.