java - Error on creating custom log4j Appender -
i'm trying create custom appender persist logs database using jpa.
the thing i'm using persistencecontext
attribute this
package com.foobar.logging; import com.foobar.model.syslog; import javax.persistence.entitymanager; import javax.persistence.persistencecontext; import org.apache.log4j.appenderskeleton; import org.apache.log4j.mdc; import org.apache.log4j.spi.loggingevent; import javax.ejb.stateless; @stateless public class logmanager extends appenderskeleton { @persistencecontext(unitname = "primary") private entitymanager em; @override protected void append(loggingevent le) { syslog log = new syslog(); log.setdescripcion(le.getmessage().tostring()); if (mdc.get("idusuario") != null) { log.setidusuario(mdc.get("idusuario").tostring()); } log.setsysaccionlog(null); this.em.persist(log); } @override public void close() { } @override public boolean requireslayout() { return false; } }
now when i'm deploying war jboss 7.1, fails, , error:
java.lang.verifyerror: class com.foobar.logging.logmanager$proxy$_$$_weld$proxy$ overrides final method getname.()ljava/lang/string;
how can use cdi inject entitymanager inside appenderskeleton? has accomplished jpa persistance in appenderskeleton using cdi?
i tried not using cdi, since every other object in app uses (jax-rs classes), collapses.
ejbs proxies. appenderskeleton
has getname
method final. think use case, need implement appender
directly. avoid bean method getname
however, have question idea of trying make appendar ejb. how instantiating it?
Comments
Post a Comment