Code: Select all
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s %(message)s",
datefmt="%Y%m%d %H:%M:%S",
handlers=[
logging.FileHandler(args.log_file),
logging.StreamHandler()
]
)
logger = logging.getLogger()
Path(args.log_file).chmod(0o644)
logger.info("this_is_a_test")
Code: Select all
-rw-r--r-- 1 root root 0 Nov 30 12:50 /u/qiang/logs/mytest/01_test_with_simulator/001_TestWithSimulator.test_happy_path/simulator.log
Mobile version