Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Logging Property Not Automatically Propagated to Client Session from Server Session

Hi Tom

Class.forName() does not throw the same exception.

I figured out another way to ensure that the Class Loader is picked up correctly.

      SEPersistenceUnitInfo puInfo = new SEPersistenceUnitInfo();
      puInfo.setClassLoader(MyLogger.class.getClassLoader());


EntityManagerSetupImpl.predeploy() contains the following line to merge the properties:

            Map predeployProperties = mergeMaps(extendedProperties, persistenceUnitInfo.getProperties());


The properties member variable of SEPersistenceUnitInfo and the actual member variables like classLoader are not in sync with each other.
Though the setClassLoader method registers the class loader a call to setProperties() on the SEPersistenceUnitInfo does not populate the classLoader member variable.
As a result the realClassLoader field in EntityManagerSetupImpl.predeploy() is null.

      puInfo.setClassLoader(MyLogger.class.getClassLoader());

I am not sure whether my implementation of PersistenceProvider is correct or not. Can you please see if I am missing something else in MyPersistenceProvider code I sent earlier?

Thanks
Rohit

On 5/30/2011 9:19 PM, Tom Ware wrote:
My best guess about your logger is that the string you are passing in isn't formatted correctly (likely due to the fact that it is an inner class).  To debug:

- try using a non-inner class to see if you're getting the right loader
- Ensure you can do a Class.forName() using that string to see if the string is correct

-Tom

Rohit Banga wrote:
  Hi Tom

Yes that was a slip in my test code. Sorry about that. So the properties are inherited by default.

Other than that instead of using SessionCustomizer I am planning to use "eclipselink.logging.logger" to configure my CustomLogger. But I am getting Class not found exceptions. The CustomLogger is a public static class nested inside the main class. Any ideas what could be causing this? I don't know what to specify in the class loader property. I tried setting it  to System.getProperty("|java.system.class.loader|"). does not work.

On 5/30/2011 8:47 PM, Tom Ware wrote:
Hi Rohit,

  The only call I see to setLogLevel in your example is on line 73.  It sets the log level on the clientSession.  Am I missing something?

  A clientSession will have the same logger as the server session that created it, so any logging settings should be the same between the sessions.

  SessionCustomizers don't really make sense on ClientSession since the things you are likely to set in them are all handled by the server session.

  Is there some other setting that is causing you problems?

-Tom

Rohit Banga wrote:
  Hi All

I have a small question. I have attached a sample program to make it easy to see the problem.

I have set the LogLevel property on the ServerSesssion. However if I do not explicitly set the LogLevel property on the clientSession, the logs for the query execution are not available on the console. I want a way such that any property specified on the server session, say SessionCustomizer, Log Level etc. is also available on the client session automatically. Can anyone please tell me how to do that using the sample code provided?

-- 
Thanks and Regards
Rohit Banga
Member Technical Staff
Oracle Server Technologies


------------------------------------------------------------------------

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

-- 
Thanks and Regards
Rohit Banga
Member Technical Staff
Oracle Server Technologies

--
Thanks and Regards
Rohit Banga
Member Technical Staff
Oracle Server Technologies

Back to the top