Properties-File to log to DB

suggest change

For this example to work you’ll need a JDBC driver compatible to the system the database is running on. An opensource one that allows you to connect to DB2 databases on an IBM System i can be found here: JT400

Even though this example is DB2 specific, it works for almost every other system if you exchange the driver and adapt the JDBC URL.

# Root logger option
log4j.rootLogger= ERROR, DB

# Redirect log messages to a DB2
# Define the DB appender   

# Set JDBC URL (!!! adapt to your target system !!!)

# Set Database Driver (!!! adapt to your target system !!!)

# Set database user name and password

# Set the SQL statement to be executed.
log4j.appender.DB.sql=INSERT INTO DB.TABLENAME VALUES('%d{yyyy-MM-dd}','%d{HH:mm:ss}','%C','%p','%m')

# Define the layout for file appender

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents