JD,

I look forward to the additional information you provide. In the meantime, just 
a bit of info that I'm planning on putting in the documentation because it was 
left out:

The JPAAppender was written for JPA 2.1 (minimum EclipseLink 2.5.0 or Hibernate 
ORM 4.3.0), but strives to have backwards compatibility with JPA 2.0 (minimum 
EclipseLink 2.0.0 or Hibernate 3.6.0). As such, there are certain JPAAppender 
features that you can use if you have JPA 2.1 that make it easier to use. If 
you only have JPA 2.0 (which it appears is the case for you), you have to do 
things "the hard way."

There are two abstract entities classes for the JPAAppender, and you should 
extend exactly one of them if you are using the JPAAppender. 
org.apache.logging.log4j.core.appender.db.jpa.AbstractLogEventWrapperEntity 
works with either 2.0 or 2.1 and requires you to provide an ID property and 
manually specify all of the getter methods and map them appropriately. If you 
are using JPA 2.1, you can use the AttributeConverters in 
org.apache.logging.log4j.core.appender.db.jpa.converter to help you convert 
certain event properties to database columns. If you are not using JPA 2.1, you 
must provide other mechanisms to convert the values.

If you are using JPA 2.1 (and only then) you can extend 
org.apache.logging.log4j.core.appender.db.jpa.BasicLogEventEntity. Using this, 
all you have to do is create a database table to match the mappings and provide 
an ID property. This abstract entity uses new JPA 2.1 features that allow it to 
instruct the JPA provider how to convert the values.

This may or may not help you. Hopefully we'll know more once you provide error 
messages, etc.

Nick

On Jul 18, 2013, at 8:58 AM, Gary Gregory wrote:

> JD,
> 
> Thank you for the info, we look forward to your further details. At this 
> point, you can put it all in a new JIRA: 
> https://issues.apache.org/jira/browse/LOG4J2
> 
> Gary
> 
> 
> On Thu, Jul 18, 2013 at 9:34 AM, JD Buys <[email protected]> wrote:
> Yes, sorry, after I sent the email I realized it was very vague.
> 
> I am using log4j2 beta8 with eclipselink 2.3.0 on mysql.
> 
> The project is a ear module with which contains a war and ejb module, and I 
> am configuring log4j via code.
> I will try and create a unit test or small program.
> 
> If the server starts up, with the ear deployed, logging to the db works, but 
> then when I deploy the ear again the logging to the db stops without any 
> exceptions.
> My configuration is done inside a singleton ejb with the @StartUp annotation.
> 
> JD
> 
> 
> On Thu, Jul 18, 2013 at 3:09 PM, Gary Gregory <[email protected]> wrote:
> Your report is too vague, can you be more precise please?
> 
> Which version of log4j2? What does your config look like? What does
> not work exactly? Can you create a unit test or small program to
> reproduce the issue? Which JPA provider? Which JDBC driver? Please
> provide any information another person would need to reproduce the
> issue you see in the most minimal manner.
> 
> Gary
> 
> On Jul 18, 2013, at 9:05, JD Buys <[email protected]> wrote:
> 
> > Hi,
> >
> > I have a strange error where if I deploy my application again, the JPA 
> > appender stops working.
> > Any ideas why?
> >
> > I am running Glassfish 3.1.1
> >
> > JD Buys
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
> 
> 
> 
> 
> -- 
> E-Mail: [email protected] | [email protected] 
> Java Persistence with Hibernate, Second Edition
> JUnit in Action, Second Edition
> Spring Batch in Action
> Blog: http://garygregory.wordpress.com 
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory

Reply via email to