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 Re: Can we add FileAppender and JDBCAppender together
Date Sat, 15 Nov 2008 07:22:16 GMT

Thanks for your response Arnold.

I have configured log4j.properties file for JDBC and File logging.

I am able to log data in file and database.

But in database, data is not in appropriate format. I am setting four
parameters, all these parameter is going to only one column.
i am setting like this :-

mylogger.info("data1"); 
mylogger.info("data2");
mylogger.info("data3");

i am getting like this :-

column1   column2   column3
data1      data1      data1
data2      data2      data2
data3      data3      data3

I want each parameter in different column like this :-

column1   column2   column3
data1     data2      data3


my log4j.properties file is :-

log4j.rootLogger=info,myAppender,JDBC
 
 # File appender
 log4j.appender.myAppender=org.apache.log4j.RollingFileAppender
 log4j.appender.myAppender.file=D:/Data/testLog.log
 log4j.appender.myAppender.maxFileSize=1024KB
 log4j.appender.myAppender.maxBackupIndex=5
 log4j.appender.myAppender.append=true
 log4j.appender.myAppender.layout=org.apache.log4j.PatternLayout
 log4j.appender.myAppender.layout.ConversionPattern=%d %p [%c] - %m%n
 
 
# DBError DB Options
 log4j.appender.JDBC=org.apache.log4j.jdbc.JDBCAppender
 log4j.appender.JDBC.URL=jdbc:oracle:thin:@10.87.187.163:1521:EPHOD1
 log4j.appender.JDBC.user=EPH_MAINTDB
 log4j.appender.JDBC.password=EPH_MAINTDB
 log4j.appender.JDBC.driver=oracle.jdbc.driver.OracleDriver
 #SQL statement to be used (with multiple columns formated)
 log4j.appender.JDBC.sql=INSERT INTO
LOGGINGMESSAGE(CODE1,CODE2,REQUESTID,COMPONENTNAME)
values('%m','%m','%m','%m')
 log4j.appender.JDBC.layout=org.apache.log4j.PatternLayout
 log4j.appender.JDBC.layout.ConversionPattern=%d %p %c - %m%n
 #log4j.appender.JDBC.layout.ConversionPattern=%m
 log4j.appender.JDBC.bufferSize=4


Please give some suggestion.
I would appreciate your suggestion.

Thanks.

Regards,
Manish 
 
-- 
View this message in context: http://www.nabble.com/Can-we-add-FileAppender-and-JDBCAppender-together-tp20497197p20513112.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