views:

221

answers:

1

I am writing to log/delayed_job.log from within a perform method:

class MyWorker
    def perform
        logger.error("testing logger")
    end
end

In log/delayed_job.log my error message is printed but without any formatting (prefixed with the date/time) compared to the other messages logged by delayed_job:

2010-03-10T14:46:18-0400: * [Worker(delayed_job host:myhost pid:10825)]
testing logger

Is there any way to use delayed_job's logger to have this similar format? Or would I have to create my own log method that prefixes the date?

A: 

You need define your own format in your Logger and use it.

shingara