How to set up DBAppender with log4j in JBoss5?
I would like to be able to set up my clustered JBoss5 instances to write log4j messages to a database. I am trying to use a DBAppender (rather than a JDBCAppender, for the reasons given in this question).
Has anyone done this? As of now, I've added an <appender>
tag to jboss-log4j.xml and put the logback-classic-0.9.17.jar file in every jar-filled folder in my JBoss directory, 开发者_JAVA百科but I'm still getting a ClassNotFoundException when JBoss tries to look for it on startup.
ANY tips/examples you can give me might be helpful, either in getting me farther in this direction, or pointing me in a better direction.
Quoting an answer from David Lloyd in this thread on the Jboss forums:
(...) The real question would be "how does one configure JBoss AS 5.1.0 to use LogBack?". The answer to that is, one doesn't; log4j is the only supported logging backend in all AS 5.x releases.
Seems pretty clear: you can't configure JBoss to use logback and, as a consequence, its DBAppender
.
So I'm afraid you'll have to go the JDBCAppender
way (Log4j) if you really want to log to a database. But I would think twite about this (or at least bench it seriously).
Just in case, maybe have a look at JBLOGGING-6.
精彩评论