Author Jonas.Diemer
Recipients Jonas.Diemer
Date 2014-07-03.12:44:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I was having trouble with the logging module under Jython: I was getting seemingly sporadic wierd null pointer exceptions in the logging code. 

The problem seemed to be related to references that were passed to the logger, e.g.

logger.debug("My object: %s", myObject)

It seems that logging defers the actual string formatting (maybe only when logging to files). By the time the string is formatted, the reference to the object may no longer be valid. In my case, myObject was a reference to a Java-class that had been invalidated.

Initially, I thought this was only a Java issue. But it seems like this could be an issue with pure Python scripts as well. E.g., what happens if the object behind myObject is changed after the call to debug(), but before the actual log message is formatted?
Date User Action Args
2014-07-03 12:44:01Jonas.Diemersetrecipients: + Jonas.Diemer
2014-07-03 12:44:01Jonas.Diemersetmessageid: <>
2014-07-03 12:44:01Jonas.Diemerlinkissue21912 messages
2014-07-03 12:44:00Jonas.Diemercreate