How to configure log4j2.xml for log4jdbc?

2019-08-02 03:37发布

问题:

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.