Log4j logging to database
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Charles_Balasingh
Posted On:   Wednesday, May 20, 2009 07:25 PM

Can any one provide the exact log4j.properties file entries for logging to a database please? I have the following config and it doesn't work: # Set root category priority to INFO and its only appender to CONSOLE. log4j.rootCategory=INFO, A1, A2 # A1 is set to be a ConsoleAppender. log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d] %C{1} - %m%n #A2 is set to be a JDBC log4j.appender.A2=org.apache.log4j.jdbc.JDBCAppender log4j.appender.A2.URL={URL removed} log4j.appender.A2.dbclass=oracle.jdbc.driver.OracleDr   More>>

Can any one provide the exact log4j.properties file entries for logging to a database please?

I have the following config and it doesn't work:

# Set root category priority to INFO and its only appender to CONSOLE.

log4j.rootCategory=INFO, A1, A2


# A1 is set to be a ConsoleAppender.

log4j.appender.A1=org.apache.log4j.ConsoleAppender

log4j.appender.A1.layout=org.apache.log4j.PatternLayout

log4j.appender.A1.layout.ConversionPattern=[%d] %C{1} - %m%n



#A2 is set to be a JDBC

log4j.appender.A2=org.apache.log4j.jdbc.JDBCAppender

log4j.appender.A2.URL={URL removed}

log4j.appender.A2.dbclass=oracle.jdbc.driver.OracleDriver

log4j.appender.A2.user={removed}

log4j.appender.A2.password={removed}

log4j.appender.A2.layout=org.apache.log4j.PatternLayout

log4j.appender.A2.layout.ConversionPattern=[%d] %C{1} - %m%n

log4j.appender.A2.sql=INSERT INTO APPLICATIONLOG (TIMESTRING, MODULENAME, COMMENTS) VALUES ('%d', '%C{1}', '%m')





I am getting a exception saying [dbclass] not provided.

But in the properties it is there. Can any one help?

   <<Less
About | Sitemap | Contact