geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karan Malhi" <karan.ma...@gmail.com>
Subject Re: [jira] Created: (GERONIMO-3445) Verify log levels can be changed for openejb related log categories
Date Thu, 06 Sep 2007 16:04:15 GMT
Can we ask the Geronimo team to set it in the
org.apache.geronimo.openejb.OpenEjbSystemGBean  class.

This is because Geronimo also uses the same classes as we use in
embedded mode. So it will not be possible to set the SystemProperty
there. For example, OpenEjbSystemGBean also uses SystemInstance, but
our code also uses SystemInstance heavily. So setting it in
SystemInstance will not lead to the desired behaviour.

We can however try the following options:

1. Ask Geronimo team to set this property in
org.apache.geronimo.openejb.OpenEjbSystemGBean

 2. Geronimo also sets a System property named "duct tape", we just
check for that
3. Geronimo also adds the GeronimoThreadContextListener to
org.apache.openejb.core.ThreadContext, we could check for that also

In case of 2 and 3 above , we do not have to ask the Geronimo team to
make any changes to their code base.

So below could be a possible logic in org.apache.openejb.util.Logger
For option 2 and 3 above we could add a method :
private void setLoggingMode(){
     if(System.getProperty("duct tape") != null){
             System.setProperty("openejb.logging.external","true");
     }else if(/*check if GeronimoThreadContextListener is a registered
listener*/){
/*
For this we would need to add a ThreadContext.getListeners() method
and then from here we can check if there is any listener whose class
name is GeronimoThreadContextListener
*/
           System.setProperty("openejb.logging.external","true");
     }else{
           System.setProperty("openejb.logging.external","false");
     }
}

The first thing the Logger would do (one time only) is set the logging
mode, and then the logging strategy could revolve around this
property.
This would be a kind of Geronimo only solution, but atleast we can fix
this thing right now and worry about other app servers later.

Do you know of any other way we could safely add the system property
openejb.logging.external in our code base which could apply to all
external clients and not only Geronimo?

On 8/30/07, David Blevins <david.blevins@visi.com> wrote:
>
> On Aug 29, 2007, at 6:12 PM, Karan Malhi wrote:
>
> > Or maybe in one of the very first  OpenEJB methods called by Geronimo
> > to start openejb in embedded mode we could add some code like
> > System.setProperty("openejb.logging","external");
> >
> > the first time the Logger class is loaded, we check for this property
> > and if it has a value of external, then we do not use
> > embedded.logging.properties otherwise we assume our default strategy.
>
> Sounds like that's the way to go.  Just check for "don't configure
> logging" and follow those orders if it's set.  Let's make the
> property be true/false.  Maybe "openejb.logging.external=true" or
> something similar.
>
>
> -David
>
>
>
>


-- 
Karan Singh Malhi

Mime
View raw message