
Don't let your application server manage your logging db connection. This may be harder than it sounds. I've had trouble in the past trying to convince weblogic that I didn't want XA transactions between two different databases. On 26 May 2011, at 03:55, Alphy <binnyal@gmail.com> wrote:
I am using JNDIConnectionSource for writing logs to my postgres DB .But I am facing a problem in transaction handling .
App Server : Glassfish.
In EJB , I have Stateteless Session Bean and I have private static final Logger auditlog = LoggerFactory.getLogger("audit");
Inside I have method for transactions.
Bean{ Method(){ Method1(); Method2(); auditlog.info("method"); } Method1() { em.persist(); auditlog.info("method1");
} Method2() { em.persist(); auditlog.info("method2");
} }
<appender name="DB" class="ch.qos.logback.classic.db.DBAppender"> <connectionSource class="ch.qos.logback.core.db.JNDIConnectionSource">
</connectionSource> </appender>
I wanted Method1 and Method 2 in one transaction and if any failure need to rollback both. Earlier when I was writing logs to file it was working fine and now when I changed to Db, I realised the call to write logs is closing existing transaction and starting new transaction to write to DB. Please let me know how I can use the same transaction for writing to logs. I am using same connection pool for both logging and application. -- View this message in context: http://old.nabble.com/LogBack--JNDIConnectionSource-tp31704423p31704423.html Sent from the Logback User mailing list archive at Nabble.com.
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user