Question

I am trying to execute a fabric function defined in a fabfile as a celery task. Now i need to create a separate log file everytime the task is executed. How can I set the logfile path everytime depending on timestamp. I need to give the link of this logfile in the end to be available for download so that the user can see the entire deployment process or error in the process.

Thanks, Rohan

Was it helpful?

Solution

task.get_logger supports a logfile argument, so you should be able to do something like this:

@task
def mytask():
    logger = self.get_logger(logfile="foo.log")
    logger.info("logging from mytask")
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top