Does anyone know how to configure the log4j2.xml file to use log4jdbc? I have been searching for several hours and I can't seem to find anything.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
log4jdbc relies on SLF4J. There is to date no proper connector between SLF4J and Log4j 2.
If you want, you can instead use log4jdbc-log4j2, which addresses exactly this need of getting log4j2 to work with log4jdbc.
回答2:
As of beta5, Log4j 2.0 does not offer a JDBC Appender. However, the team is working on one and it is likely that a subsequent release will contain one.
Which also means: if you have any feature requests, ideas or comments, now would be a good time to let the team know!
The dev mailing list, user mailing list or Jira issue tracker are all fine places to get your voice heard.
Update: As of beta 7, Log4j2 offers JDBC, JPA, and NoSQL database appenders.