In python I wrote the configfile.properties
file as following for logging:
[loggers]=
keys=root
[handlers]=
keys=fileHandler
[formatters]=
keys=myFormatter
[logger_root]=
level=INFO
handlers=fileHandler
[handler_fileHandler]=
class=FileHandler
level=INFO
formatter=myFormatter
args=("/opt/myfile1.log",)
[formatter_myFormatter]=
format=%(process)d-%(levelname)s-%(asctime)s %(name)s->%(funcName)s->%(lineno)-d: %(message)s
And i used it in a .py file as following:
import logging
import logging.config
logging.config.fileConfig(fname='configfile.properties', disable_existing_loggers=False)
logger = logging.getLogger(__name__)
I call multiple REST API service and then i want to store each APIs log in specific files, I need to create multi log file (/opt/myfile1.log
, /opt/myfile2.log
, /opt/myfile3.log
) with one config file. Is there any way to create these files using that configfile.properties
?