You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Anil Chawla <ac...@us.ibm.com> on 2010/08/19 17:09:05 UTC

Issue regarding GeronimoLog


Hi,
We are moving our application to Geronimo and are encountering an issue
with GeronimoLog. The core problem is that we are using the Apache Pig
library and need to serialize objects created by that library. The Pig
classes use the commons logging framework and unfortunately maintain Log
references as instance fields rather than static fields -- which means that
the Log field is also serialized when the object is serialized. This causes
a failure on Geronimo when trying to serialize the Pig objects because the
GeronimoLog implementation is not serializable. We are trying to find a
solution without modifying all of the Pig classes.

The only solution we have found so far is to dynamically set the
"org.apache.commons.logging.LogFactory" system property when our
application starts in order to replace the GeronimoLogFactory
implementation with our own custom LogFactory implementation. Our custom
LogFactory wraps GeronimoLog in order to make it serializable without
breaking the normal server logging behavior. The problem with this approach
is that it changes the LogFactory implementation for the entire VM and our
classes are not available to other applications in the container.

* Is there a way to replace the LogFactory/Log implementation but isolate
that change to a specific WAR/EAR within Geronimo?

* Are there  any other ideas on how we might work around this issue?

Thanks so much!

Anil Chawla

Re: Issue regarding GeronimoLog

Posted by Anil Chawla <ac...@us.ibm.com>.
Ivan, thanks for the pointer. I was able to fix the issue by adding the
following to the deployment plan:

    <hidden-classes>
  	<filter>org.apache.geronimo.kernel.log.GeronimoLogFactory</filter>

<filter>META-INF/services/org.apache.commons.logging.LogFactory</filter>
    </hidden-classes>
    <inverse-classloading/>

Note that, even with the class filters, I had to add the
<inverse-classloading/> property to prevent commons logging from picking up
GeronimoLogFactory from the parent classloader.

Anil Chawla



|------------>
| From:      |
|------------>
  >----------------------------------------------------------------------------------------------------------------------------------------|
  |Ivan <xh...@gmail.com>                                                                                                                 |
  >----------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| To:        |
|------------>
  >----------------------------------------------------------------------------------------------------------------------------------------|
  |user@geronimo.apache.org                                                                                                                |
  >----------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Date:      |
|------------>
  >----------------------------------------------------------------------------------------------------------------------------------------|
  |08/19/2010 09:36 PM                                                                                                                     |
  >----------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Subject:   |
|------------>
  >----------------------------------------------------------------------------------------------------------------------------------------|
  |Re: Issue regarding GeronimoLog                                                                                                         |
  >----------------------------------------------------------------------------------------------------------------------------------------|





Hi,
    Refer to this thread, it should be helpful.

http://apache-geronimo.328035.n3.nabble.com/Application-specific-log4j-issue-tc863758.html#a863758



2010/8/19 Anil Chawla <ac...@us.ibm.com>
  Hi,
  We are moving our application to Geronimo and are encountering an issue
  with GeronimoLog. The core problem is that we are using the Apache Pig
  library and need to serialize objects created by that library. The Pig
  classes use the commons logging framework and unfortunately maintain Log
  references as instance fields rather than static fields -- which means
  that the Log field is also serialized when the object is serialized. This
  causes a failure on Geronimo when trying to serialize the Pig objects
  because the GeronimoLog implementation is not serializable. We are trying
  to find a solution without modifying all of the Pig classes.

  The only solution we have found so far is to dynamically set the
  "org.apache.commons.logging.LogFactory" system property when our
  application starts in order to replace the GeronimoLogFactory
  implementation with our own custom LogFactory implementation. Our custom
  LogFactory wraps GeronimoLog in order to make it serializable without
  breaking the normal server logging behavior. The problem with this
  approach is that it changes the LogFactory implementation for the entire
  VM and our classes are not available to other applications in the
  container.

  * Is there a way to replace the LogFactory/Log implementation but isolate
  that change to a specific WAR/EAR within Geronimo?

  * Are there any other ideas on how we might work around this issue?

  Thanks so much!

  Anil Chawla





--
Ivan


Re: Issue regarding GeronimoLog

Posted by Ivan <xh...@gmail.com>.
Hi,
    Refer to this thread, it should be helpful.

http://apache-geronimo.328035.n3.nabble.com/Application-specific-log4j-issue-tc863758.html#a863758


2010/8/19 Anil Chawla <ac...@us.ibm.com>

> Hi,
> We are moving our application to Geronimo and are encountering an issue
> with GeronimoLog. The core problem is that we are using the Apache Pig
> library and need to serialize objects created by that library. The Pig
> classes use the commons logging framework and unfortunately maintain Log
> references as instance fields rather than static fields -- which means that
> the Log field is also serialized when the object is serialized. This causes
> a failure on Geronimo when trying to serialize the Pig objects because the
> GeronimoLog implementation is not serializable. We are trying to find a
> solution without modifying all of the Pig classes.
>
> The only solution we have found so far is to dynamically set the
> "org.apache.commons.logging.LogFactory" system property when our application
> starts in order to replace the GeronimoLogFactory implementation with our
> own custom LogFactory implementation. Our custom LogFactory wraps
> GeronimoLog in order to make it serializable without breaking the normal
> server logging behavior. The problem with this approach is that it changes
> the LogFactory implementation for the entire VM and our classes are not
> available to other applications in the container.
>
> * Is there a way to replace the LogFactory/Log implementation but isolate
> that change to a specific WAR/EAR within Geronimo?
>
> * Are there any other ideas on how we might work around this issue?
>
> Thanks so much!
>
> Anil Chawla
>



-- 
Ivan