What do you mean by "seperate the logs according to databases of my system"? Could you give an example of how you would expect this to behave?
Note that with log4j you can log to separate files by using different categories, and usually the category name reflects the class' package name. As long as each database is used by a different application, and each application uses a different package name, then log4j can handle it. Anything else and you will be doing a lot of custom coding.