Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Setting the logging level in running J2EE app

Unless you have specified the <property name="eclipselink.logging.logger" value="DefaultLogger"/> tag, application managed EMs on Weblogic will use WebLogic's logger which can be dynamically controlled through the console. I'm not all that familiar with the setup, but the JPA tab would be the same as it was in previous releases, so the steps outlined here should be acurate:
http://forums.oracle.com/forums/thread.jspa?threadID=762974&tstart=0

Changing the logger is described here http://wiki.eclipse.org/EclipseLink/Examples/JPA/Logging

If you are not using WebLogic logging, EclipseLink can be modified using the MBeans described here:http://wiki.eclipse.org/Integrating_EclipseLink_with_an_Application_Server_(ELUG)#How_to_Integrate_JMX Within the RuntimeServices class it extends there is a setLogLevel method allowing dynamic changes.

Using the code you have shown though, you would call helper.getSession().setLogLevel(int) instead of setProperties.


Best Regards,
Chris

On 12/07/2013 4:52 PM, Dennis Fuglsang wrote:
My EclipseLink-based application is running within Weblogic and I would
like to temporarily reset the logging level while the application is
running so I can debug it.    Is there a way to programmatically change
the logging level on an existing EntityManager or
EntityManagerFactory?    My first attempt is shown below where I set the
“eclipselink.logging.level.sql” property on the EntityManager.

*public**static**void*setPropertiesOnEntityManager(EntityManager
entityManager, *final*Map<String, Object> properties) {

*if*(properties != *null*&& !properties.isEmpty()) {


((org.eclipse.persistence.internal.jpa.EntityManagerImpl)entityManager.getDelegate()).setProperties(properties);


             DynamicHelper helper = *new*JPADynamicHelper(entityManager);

*for*(Map.Entry<String, Object> entry : properties.entrySet()) {

                 helper.getSession().setProperty(entry.getKey(),
entry.getValue());

             }

         }

     }

Any help or suggestions is greatly appreciated.  Thanks

Dennis Fuglsang



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



Back to the top