logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From manish_goyal <manishkumar_go...@infosys.com>
Subject Can we add FileAppender and JDBCAppender together
Date Fri, 14 Nov 2008 09:23:29 GMT

Hi,

Please tell me can we add FileAppender and JDBCAppender together in a
log4j.properties file.

I configured my log4j.properties file for both FileAppender and
JDBCAppender, FileAppender is working fine but JDBCAppender is not working.
My log4j.properties file is :-

log4j.rootCategory=JDBC
log4j.appender.JDBC=DBError
log4j.logger.com.cvs.eph.test=info,myAppender,DBError

# File appender
log4j.appender.out=org.apache.log4j.RollingFileAppender
log4j.appender.out.file=D:/Data/myLog.log
log4j.appender.out.maxFileSize=1024KB
log4j.appender.out.maxBackupIndex=5
log4j.appender.out.append=true
log4j.appender.out.layout=org.apache.log4j.PatternLayout
log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} -
%m%n

# DBError DB Options
log4j.appender.JDBC=org.apache.log4j.jdbcplus.JDBCAppender
log4j.appender.JDBC.URL=jdbc:oracle:thin:@10.87.187.163:1521:EPHOD1
log4j.appender.JDBC.user=test
log4j.appender.JDBC.password=test
log4j.appender.JDBC.driver=oracle.jdbc.driver.OracleDriver
#SQL statement to be used (with multiple columns formated)
log4j.appender.JDBC.layout=org.apache.log4j.PatternLayout
log4j.appender.JDBC.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1}
- %m%n
log4j.appender.JDBC.sql=INSERT INTO MYTABLE(CODE1,CODE2,REQUESTID) values
(code1,code2,requestID)
 
log4j.appender.JDBC.bufferSize=3

and my JAVA file is :-

import org.apache.log4j.jdbcplus.JDBCAppender;

JDBCAppender DBError = new JDBCAppender();
DBError.setLayout(myLayout);
try
          {
    			Driver d =
(Driver)(Class.forName("oracle.jdbc.driver.OracleDriver").newInstance());
    			DriverManager.registerDriver(d);
    		}
          catch(Exception e){}
String url =
    	    "jdbc:oracle:thin:@"
    	      + "(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST
= 10.87.187.163)(PORT = 1521)))" +
    	        "(CONNECT_DATA = (SERVICE_NAME = EPHOD1)))";
DBError.setUrl(url);
DBError.setUsername("test");
DBError.setPassword("test");
DBError.setTable("MYTABLE");
myLogger.addAppender(DBError);

I am getting  following error:-
log4j:ERROR JDBCAppender::flush_buffer(), : 
java.sql.SQLException: ORA-01732: data manipulation operation not legal on
this view


for the myLogger.info("Hello");


Please give me pointers to solve this problem.

Thanks.

Regards,
Manish



-- 
View this message in context: http://www.nabble.com/Can-we-add-FileAppender-and-JDBCAppender-together-tp20497197p20497197.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message