DBAppender - how to change default table names?

2019-05-06 23:47发布

is it possibly to change default table names for DBAppender in logback and how can I do it ?

P.S. Browsing sources I found that DBAppender have property implemented DBNameResolver interface for getting table names, I can implement this interface in custom made dbNameResolver and then use custom made table names, but the major problem for me is how to set that custom made dbNameResolver into original DBAppender... is that possibly ?

标签: java logback
1条回答
女痞
2楼-- · 2019-05-07 00:26

From the API docs, DBAppender has a setDbNameResolver() property which could be invoked programatically, or, if I've understood how the configuration file works properly just using something like:

<appender name="DB" class="ch.qos.logback.classic.db.DBAppender">
   <.../>
   <dbNameResolver class="fqdn.to.my.DBNameResolver"/>
</appender>
查看更多
登录 后发表回答