[AG-DEV] Logging levels tip
Christoph Willing
willing at itee.uq.edu.au
Wed Jul 6 00:22:55 CDT 2005
I had a logging problem in a shared application which is now solved,
following a hint from Tom at today's (late) townhall. I thought I'd
share the solution, since the problem is likely to occur often and I
couldn't see the solution anywhere obvious in the programming manuals.
The problem was: my new shared had only a very few log.info, log.debug
calls, yet its log file was filling up fairly quickly to quite a large
size. Inspection of the log file showed it was filling up due to lots
of messages from the EventClient; that made sense since the shared app
had event-related stuff happening every few seconds. How to stop the
EventClient logging?
The solution is: after initialising the application with
app.Initialize(), do something like:
loglevels = app.GetLogLevels()
then, either
loglevels.SetLevel(Log.CRITICAL)
or even
loglevels.SetLevel(Log.CRITICAL, Log.EventClient)
The second version blocks all but critical & above log messages
specifically from the EventClient. To allow full logging from the rest
of the application, I'm using
app.Initialize(name) # name of shared app
loglevels = app.GetLogLevels()
loglevels.SetLevel(Log.NOTSET, name)
loglevels.SetLevel(Log.CRITICAL, Log.EventClient)
The levels (Log.CRITICAL etc.) seem to be just integers, with a bunch
of preset levels available from the AccessGrid.Log module
(see:http://www-unix.mcs.anl.gov/fl/research/accessgrid/documentation/
developer/api/index.html)
chris
Christoph Willing Ph: +61 7 3365 8350
QPSF Access Grid Manager
University of Queensland
More information about the ag-dev
mailing list