[ 
https://issues.apache.org/jira/browse/PIG-1955?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13014815#comment-13014815
 ] 

Richard Ding commented on PIG-1955:
-----------------------------------

I think we should make loggers static (and final). The problem with transient 
is that it doesn't work the way you expect. As it is transient, the logger 
would not be serialized, and when the object is deserialized, the logger is 
initialized to null (default value). 

> PhysicalOperator has a member variable (non-static) Log object that is 
> non-transient, this causes serialization errors
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: PIG-1955
>                 URL: https://issues.apache.org/jira/browse/PIG-1955
>             Project: Pig
>          Issue Type: Bug
>          Components: impl
>    Affects Versions: 0.8.0, 0.9.0
>            Reporter: Woody Anderson
>            Assignee: Woody Anderson
>             Fix For: 0.8.0, 0.9.0
>
>         Attachments: 1955-po.patch, 1955.patch
>
>
> I found this while trying to write unit tests. Creating a local PigServer to 
> test my LoadFunc caused a serialization of the PhysicalOperator class, which 
> failed due to:
> ..
> Caused by: java.io.NotSerializableException: 
> org.apache.commons.logging.impl.Log4JCategoryLog
> ..
> this is easily fixed by adding the transient keyword to the definition of log.
> e.g.
> on trunk:
>     private final transient Log log = LogFactory.getLog(getClass());
> on the 0.8 tag:
>     private transient Log log = LogFactory.getLog(getClass());

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to