[Bigjob-users] prints in module code

Ole Weidner oweidner at cct.lsu.edu
Thu Dec 15 23:05:15 CST 2011


Hi Andre,

there is still a small issue with your implementation, since bigjob configures and uses a 'global' logger. This leads to all sorts of strange problem if you include bigjob from an application that uses the logging framework itself (which is the case for my bigjob-service). Would it be possible to replace this code in bigjob_manager.py:

logging.basicConfig(level=logging.DEBUG, datefmt='%m/%d/%Y %I:%M:%S %p',
                   format='%(asctime)s - %(levelname)s - %(message)s')

with

logger = logging.getLogger(name='bigjob.framework')
l_formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
l_handler = logging.StreamHandler()
l_handler.setFormatter(l_formatter)
logger.addHandler(l_handler)
logger.setLevel(logging.DEBUG)

Throughout the bigjob code, you can either pass on the 'logger' handle or reference it by name, e.g.,

logging.getLogger(name='bigjob.framework').debug("Utilizing Redis backend")

instead of using the global logger 'logging.debug("Utilizing Redis Backend")'. That would be really helpful. 

Many thanks! 

- Ole



On Dec 14, 2011, at 3:12 PM, Andre Luckow wrote:

> Hi Ole,
> thanks for the hints. I improved the logging in BJ 0.3.32.
> 
> Best,
> Andre
> 
> On Wed, Dec 14, 2011 at 8:15 PM, Ole Weidner <oweidner at cct.lsu.edu> wrote:
>> Hi,
>> 
>> it seems that there some print statements in the BigJob module code. E.g.,
>> 
>> Adaptor specific modifications: fork
>> Working directory: /Users/oweidner/Projects/agent
>> use standard proxy
>> Submit pilot job to: fork://localhost/
>> Pilot Job/BigJob URL: bigjob:b8a1e6a2-2686-11e1-b776-0019e3f8ce4e:localhost State: Running
>> 
>> Can the logging facility be used instead, so it can be filtered and / or suppressed? A nicer default logging output format would be great, too, e.g.,
>> 
>> logging.basicConfig(level=loglevel, datefmt='%m/%d/%Y %I:%M:%S %p',
>>                    format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
>> logger = logging.getLogger(name='bigjob')
>> 
>> I'm using BigJob-0.3.31 via PyPi.
>> 
>> Cheers,
>> Ole
>> 
>> _______________________________________________
>> Bigjob-users mailing list
>> Bigjob-users at mail.cct.lsu.edu
>> https://mail.cct.lsu.edu/mailman/listinfo/bigjob-users



More information about the Bigjob-users mailing list