[
https://issues.apache.org/jira/browse/PIG-1955?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Woody Anderson updated PIG-1955:
--------------------------------
Attachment: 1955-po.patch
Ok. Unfortunately, this issue is more pervasive than i originally thought.
The 'simple' fix that is attached makes the PO logger transient protected and
removes the loggers from all subclasses which are defined often incorrectly
(non-transient members) and inconsistently.
Personally, when i define loggers i always make them private and STATIC so that
there is no getClass() call. this makes finding the class where the log line
resides in source code much simpler to find. I dislike loggers that define
themselves with getClass() b/c logging code in A.java will report as class B in
output if class B extends class A.
I did not change this behavior b/c perhaps someone has their reasons for doing
what they did. I did however remove some of the static loggers simply to ensure
consistency (the majority were done with member variables).
The change to static private is also not such a big deal if anyone agrees we
should consistently go that way instead.
> 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