i have this configuration for log4j for my web services:

```
# Define the root logger with appender file
log4j.logger.com.package = INFO, DB

# Define the DB appender
log4j.appender.DB=org.apache.log4j.jdbc.JDBCAppender

# Set JDBC URL
log4j.appender.DB.URL=jdbc:mysql://127.0.0.1/MYDB

# Set Database Driver
log4j.appender.DB.driver=com.mysql.jdbc.Driver

# Set database user name and password
log4j.appender.DB.user=agent
log4j.appender.DB.password=secret
# Set the SQL statement to be executed.
log4j.appender.DB.sql=INSERT INTO TABLE VALUES(TIMESTAMP(now()),'%C','%p','%m')

# Define the layout for file appender
log4j.appender.DB.layout=org.apache.log4j.PatternLayout

```

Works, but after some hours (no operations) loss connection and not save anything into DB.

There is some configuration that i missed?

Is possible set something like:

```
log4j.appender.DB.testOnBorrow = true
log4j.appender.DB.validationQuery = "SELECT 1"

```