Moss,
   Thanks for the help.  I called PropertyConfigurator after the .echo call and things work now.

It's test code.  I changed the name of the java package to protect the innocent.

Thanks again.

Kris

On 4/28/06, Moss Prescott <moss@termalabs.com> wrote:
Kris,

It looks like your problem is just that you're calling the Java method
before you initialize log4j. Have you tried simply calling SLBOs.echo()
_after_ the call to PropertyConfigurator?

The log4j configuration is held in static members of the log4j classes,
which are being shared by both your Jython module and your Java class,
so it isn't really a question of passing the configuration from one to
the other.

Also, and maybe this is just the test code you posted, but you are
re-using "test," which starts off as an instance of SLBOs and then gets
redefined as a Jython function. Seems like this could be confusing...

Good luck,

-moss

Kris Thieler wrote:
> Is it possible for a java class to pick up the log4j configuration in
> jython?  I have the java class and jython script below.  log4j
> initializes in the jython script.  However, the jython script does not
> pass the configuration to the class.
>
>
>
>
> I have the following java class
>
> package test.sbl;
>
> import java.io.*;
> import java.nio.MappedByteBuffer;
> import java.nio.channels.FileChannel;
> import java.util.* ;
> import org.apache.log4j.Logger ;
>
> public class SBLOs {
>
>
>     static Logger logger = Logger.getLogger(SBLOs.class);
>
>
>
> public void echo (String message){
>     logger.debug("String: "+message+"Has been passed");
>
> }
>
>
>
> test.py
>
> from test.sbl import SBLOs
> from org.apache.log4j import *
>
> import sys
>
> test = SBLOs()
> test.echo("hello")
>
> print 'Hello Jython World!'
>
> logger = Logger.getLogger(__name__);
> loggerconfig =
> PropertyConfigurator.configure("C:\\\deployLogger.properties
> ");
>
>
> def test():
>     logger.debug("inside test method")
>
> logger.debug ("log4j inside jython")
> test()

--
terma | software labs

Moss Prescott