Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Passing logs from JNI to JVM side

843829May 3 2009 — edited May 7 2009
Hello everybody,

I have application which works both in standalone and Web Start modes. It also uses JNI widely.
I have a specific error when launching application in Web Start mode. There is no such error in standalone mode. In order to find out the difference I would rely on debug messages, but there was a catch.
In Web Start mode I am able to see only those messages that were put into System.out. They are displayed in Java Console.
Logs which are put into stdout by native side are not displayed in Java Console and I can not figure out what happens there.

I have an idea to pass all native debug messages onto JVM side and then put them into System.out as well.
Currently I use log4j on JVM and log4cpp on native side.
The pitfall I suspect there is about having to deal with JNIEnv pointer. I'd like to delegate the responsibility of passing jstring containing the message to a dedicated log4cpp logger. But in that case logger will have to deal with number of JNIEnv pointers one for each single thread.

What do you think about it? Is there better solution than this?

Thank you,
Alex.

Edited by: Alexander_P on May 3, 2009 1:03 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 4 2009
Added on May 3 2009
16 comments
1,143 views