From log4j
property file ,I have a need to insert data in multiple tables.
So I need to write multiple query for a jdbc
appender for logging to database.
From log4j
property file ,I have a need to insert data in multiple tables.
So I need to write multiple query for a jdbc
appender for logging to database.
Seems that the stock JDBCAppender in log4j-package, or other DB-appenders I found do not allow multiple inserts per log-event.
Attaching 2 JDBCAppenders to log4j could solve your problem. Having 2 appenders would on the other hand cause some transaction overhead, and the rows inserted into database wont have any relation with each other.
Another solution I can think of is writing your own appender, like in the accepted answer of question How to create a own Appender in log4j?
Maybe using FlumeAppender would be a good solution to the scenario that you described.
Apache Flume is a distributed, reliable, and available system for efficiently collecting, aggregating, and moving large amounts of log data from many different sources to a centralized data store. The FlumeAppender takes LogEvents and sends them to a Flume agent as serialized Avro events for consumption.
More details in: https://logging.apache.org/log4j/2.x/manual/appenders.html#FlumeAppender