This is the database schema
create table log4j_messages
(
message varchar(2000),
class varchar(255),
priority varchar(64),
log_date timestamp
);
and below is my log4j properties
log4j.appender.jdbc=org.apache.log4j.jdbc.JDBCAppender
log4j.appender.jdbc.driver=org.postgresql.Driver
log4j.appender.jdbc.URL=jdbc:postgresql://MYSERVER:5432/logs
log4j.appender.jdbc.user=logs
log4j.appender.jdbc.password=MYPASS
log4j.appender.jdbc.sql=INSERT INTO log4j_messages (message, class, priority, log_date) values ('%m', '%c', '%p', to_timestamp('%d', 'YYYY-MM-DD HH24:MI:SS,MS'))
No data is being logged to the database. Is there anyway I can find out what the problem is?
EDIT:
I tried adding log4j.rootCategory=DEBUG at the top of the properties file and now I get the following warnings.
log4j:WARN No appenders could be found for logger (myprogram.Main). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
below is the working version of my log4j properties file when writing to files
log4j.rootCategory=DEBUG, R, O
# Stdout
log4j.appender.O=org.apache.log4j.ConsoleAppender
# File
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=log4j.log
# Control the maximum log file size
log4j.appender.R.MaxFileSize=500KB
# Archive log files (one backup file here)
log4j.appender.R.MaxBackupIndex=1
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.O.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=[%d{ISO8601}]%5p%6.6r[%t]%x - %C.%M(%F:%L) - %m%n
log4j.appender.O.layout.ConversionPattern=[%d{ISO8601}]%5p%6.6r[%t]%x - %C.%M(%F:%L) - %m%n
log4j.propertiesincluded in the jar? It seems like it cannot find it. - Hiery Nomus