Permalink
Browse files

Usage Server logging and peristance xml improvements

  • Loading branch information...
twschiller committed Sep 19, 2013
1 parent 76cfdc7 commit ac9d56f18541ddac053d5031ed1b5420800f7855
@@ -11,11 +11,14 @@
<class>edu.washington.cs.cupid.usage.server.data.CupidUser</class>
<class>edu.washington.cs.cupid.usage.server.data.SystemData</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="datanucleus.NontransactionalRead" value="true"/>
<property name="datanucleus.NontransactionalWrite" value="true"/>
<property name="datanucleus.ConnectionURL" value="appengine"/>
<property name="datanucleus.singletonEMFForName" value="true"/>
</properties>
</persistence-unit>
</persistence>
@@ -39,7 +39,12 @@
private Gson gson = new Gson();
private void writeSession(final JsonCupidSession raw){
if (raw == null) throw new IllegalArgumentException("Received null session data from client");
log.info("Received data for uuid " + raw.uuid);
EntityManager em = EMFService.get().createEntityManager();
if (em == null) throw new RuntimeException("Error loading entity manager");
try{
EntityTransaction tx = em.getTransaction();
@@ -68,7 +73,10 @@ private void writeSession(final JsonCupidSession raw){
em.persist(user);
tx.commit();
log.info("Recorded data for uuid " + raw.uuid);
} catch (RuntimeException ex){
log.log(Level.WARNING, "Error recording data for uuid " + raw.uuid, ex);
throw ex;
} finally {
if (tx.isActive()){

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.
@@ -10,4 +10,4 @@
#
# Set the default logging level for all loggers to WARNING
.level = WARNING
.level = INFO

0 comments on commit ac9d56f

Please sign in to comment.