log4j JDBCAppender rotate table name

前端 未结 3 1688
旧巷少年郎
旧巷少年郎 2021-01-22 13:31

I have successfully configured an application that uses log4j for it\'s logging to log into a MySQL database. (Using org.apache.log4j.jdbc.JDBCAppender).

I also have som

3条回答
  •  北恋
    北恋 (楼主)
    2021-01-22 13:53

    You'd have to write your own appender to do this.

    Another option would be to stay with the existing appender and do this:

    You have a table in your database named log. Why not make a Perl script that makes a new table at end of every month, let's say log_12 for December, copies everything from log to log_12 and then delete everything from log? That way you don't have to mess around with making another appender.

提交回复
热议问题