As porfiriopartida mentioned in the comments, I think you are nearly there but you only need to change the way you create the Loggers in your (test) application:
public static void testExists() {
Logger console = LogManager.getLogger(getClass());
Logger dbLog = LogManager.getLogger("sptestlog"); // match config Logger name!
console.info("== write this to the console ==");
dbLog.info("== write this to the db2 log ==");
}
Only loggers created with LogManager.getLogger("sptestlog")
will be appending to the JDBC appender you configured. Loggers with any other name will log to the console.
The 2013-10-02 11:31:08,224 DEBUG ServletContext not present - WebLookup not added
line is not related to JDBC logging. Log4J does some extra initialization in web containers. If it cannot find a web container it does not need to do this initialization.