Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Log4j - JDBCLogger::setLogType() throws a column is not writable message  RSS feed

Priyaa V Kumar
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am trying to use the JDBCAppender provided in the package org.apache.log4j.jdbcplus to write to multiple columns of a particular table.

I get a java class enclosing some integer and string members. I want these values to go into different columns of a table.

My program has the following code snippet

// Create a new instance of JDBCAppender
JDBCAppender ja = new JDBCAppender();
ja.setUrl("jdbc dbc:test");

ResultObject rslt = null; //my java class with some ints & strings

for (int i = 0; i < 1; i++)
rslt = new ResultObject();

rslt.setName("Actual name " + i);

ja.setColumn("Col1", JDBCLogType.EMPTY, "" + rslt.getCol1());
ja.setColumn("Col2", JDBCLogType.EMPTY, "" + rslt.getCol2());
ja.setColumn("Col3", JDBCLogType.EMPTY, "" + rslt.getCol3());

ja.setColumn("Name", JDBCLogType.MSG, "" +rslt.getName());;


I get the message/error

log4j:ERROR JDBCAppender::configure()
java.lang.Exception: JDBCLogger::setLogType(), Column COL1 is not writeable !
at org.apache.log4j.jdbcplus.JDBCLogger.setLogType(
at org.apache.log4j.jdbcplus.JDBCAppender.configure(
at org.apache.log4j.jdbcplus.JDBCAppender.ready(
at org.apache.log4j.jdbcplus.JDBCAppender.append(
at org.apache.log4j.AppenderSkeleton.doAppend(

Is the database readonly? Using this same user id & password, I was able to write to this table using a simple java.sql.Statement?

Please let me know if I am missing something here...
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!