You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Karan Malhi <ka...@gmail.com> on 2007/09/06 18:04:15 UTC

Re: [jira] Created: (GERONIMO-3445) Verify log levels can be changed for openejb related log categories

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 <da...@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

Re: [jira] Created: (GERONIMO-3445) Verify log levels can be changed for openejb related log categories

Posted by Jacek Laskowski <ja...@laskowski.net.pl>.
On 9/6/07, David Blevins <da...@visi.com> wrote:
> Cool.  I've updated the Geronimo side as follows:

...and I've created a page about how the OpenEJB-Geronimo integration
works in Geronimo Wiki [1] where I expect to find information on
openejb.logger.external as well (I purposely wrote 'I expect' as I'm
not sure when I find some spare time to approach it ;-)). I'll try to
collect as much information there as I can as I see a great need to
improve it and my knowledge about it.

[1] http://cwiki.apache.org/confluence/display/GMOxKB/How+OpenEJB+integration+works

p.s. I know I shouldn't use Confluence URLs, but rather their html
version, but it's not been autogenerated yet and I didn't mean to wait
announcing it.

Jacek

-- 
Jacek Laskowski
http://www.JacekLaskowski.pl

Re: [jira] Created: (GERONIMO-3445) Verify log levels can be changed for openejb related log categories

Posted by David Blevins <da...@visi.com>.
Cool.  I've updated the Geronimo side as follows:

Index: src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java
===================================================================
--- src/main/java/org/apache/geronimo/openejb/ 
OpenEjbSystemGBean.java   (revision 570242)
+++ src/main/java/org/apache/geronimo/openejb/ 
OpenEjbSystemGBean.java   (working copy)
@@ -104,7 +104,8 @@
          }
          System.setProperty("duct tape","");
          System.setProperty("admin.disabled", "true");
-
+        System.setProperty("openejb.logger.external", "true");
+
          setDefaultProperty("openejb.deploymentId.format",  
"{moduleId}/{ejbName}");
          setDefaultProperty("openejb.jndiname.strategy.class",  
"org.apache.openejb.assembler.classic.JndiBuilder$TemplatedStrategy");
          setDefaultProperty("openejb.jndiname.format",  
"{deploymentId}/{interfaceClass}");


On Sep 6, 2007, at 1:52 PM, Karan Malhi wrote:

> Yes it should work.
>
> On 9/6/07, David Blevins <da...@visi.com> wrote:
>>
>> On Sep 6, 2007, at 9:04 AM, Karan Malhi wrote:
>>
>>> 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
>>
>> Not sure I followed the explanation above.  Ideally we'd be able to
>> use option 1 here as that's what we do for other properties.
>> Setting openejb.logging.external=true as a plain system property in
>> OpenEjbSystemGBean should work right?
>>
>> -David
>>
>>
>>
>
>
> -- 
> Karan Singh Malhi
>


Re: [jira] Created: (GERONIMO-3445) Verify log levels can be changed for openejb related log categories

Posted by David Blevins <da...@visi.com>.
Cool.  I've updated the Geronimo side as follows:

Index: src/main/java/org/apache/geronimo/openejb/OpenEjbSystemGBean.java
===================================================================
--- src/main/java/org/apache/geronimo/openejb/ 
OpenEjbSystemGBean.java   (revision 570242)
+++ src/main/java/org/apache/geronimo/openejb/ 
OpenEjbSystemGBean.java   (working copy)
@@ -104,7 +104,8 @@
          }
          System.setProperty("duct tape","");
          System.setProperty("admin.disabled", "true");
-
+        System.setProperty("openejb.logger.external", "true");
+
          setDefaultProperty("openejb.deploymentId.format",  
"{moduleId}/{ejbName}");
          setDefaultProperty("openejb.jndiname.strategy.class",  
"org.apache.openejb.assembler.classic.JndiBuilder$TemplatedStrategy");
          setDefaultProperty("openejb.jndiname.format",  
"{deploymentId}/{interfaceClass}");


On Sep 6, 2007, at 1:52 PM, Karan Malhi wrote:

> Yes it should work.
>
> On 9/6/07, David Blevins <da...@visi.com> wrote:
>>
>> On Sep 6, 2007, at 9:04 AM, Karan Malhi wrote:
>>
>>> 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
>>
>> Not sure I followed the explanation above.  Ideally we'd be able to
>> use option 1 here as that's what we do for other properties.
>> Setting openejb.logging.external=true as a plain system property in
>> OpenEjbSystemGBean should work right?
>>
>> -David
>>
>>
>>
>
>
> -- 
> Karan Singh Malhi
>


Re: [jira] Created: (GERONIMO-3445) Verify log levels can be changed for openejb related log categories

Posted by Karan Malhi <ka...@gmail.com>.
Yes it should work.

On 9/6/07, David Blevins <da...@visi.com> wrote:
>
> On Sep 6, 2007, at 9:04 AM, Karan Malhi wrote:
>
> > 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
>
> Not sure I followed the explanation above.  Ideally we'd be able to
> use option 1 here as that's what we do for other properties.
> Setting openejb.logging.external=true as a plain system property in
> OpenEjbSystemGBean should work right?
>
> -David
>
>
>


-- 
Karan Singh Malhi

Re: [jira] Created: (GERONIMO-3445) Verify log levels can be changed for openejb related log categories

Posted by Karan Malhi <ka...@gmail.com>.
Yes it should work.

On 9/6/07, David Blevins <da...@visi.com> wrote:
>
> On Sep 6, 2007, at 9:04 AM, Karan Malhi wrote:
>
> > 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
>
> Not sure I followed the explanation above.  Ideally we'd be able to
> use option 1 here as that's what we do for other properties.
> Setting openejb.logging.external=true as a plain system property in
> OpenEjbSystemGBean should work right?
>
> -David
>
>
>


-- 
Karan Singh Malhi

Re: [jira] Created: (GERONIMO-3445) Verify log levels can be changed for openejb related log categories

Posted by David Blevins <da...@visi.com>.
On Sep 6, 2007, at 9:04 AM, Karan Malhi wrote:

> 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

Not sure I followed the explanation above.  Ideally we'd be able to  
use option 1 here as that's what we do for other properties.    
Setting openejb.logging.external=true as a plain system property in  
OpenEjbSystemGBean should work right?

-David