Suneel, Can I change the configuration in log4j.xml and achieve this without changing my classes? The jdbc appender in my log4j.xml is:
<appender name="SystemJdbcAppender" class=" org.apache.log4j.jdbcplus.JDBCAppender"> <param name="url" value="jdbc:oracle:thin:@172.20.20.51:1521:orcl"/> <param name="dbclass" value="oracle.jdbc.driver.OracleDriver"/> <param name="username" value="test123"/> <param name="password" value="test123"/> <param name="sql" value="INSERT INTO LOGSTABLE (id, prio, cat, thread, msg, throwable, the_timestamp, created_by) VALUES (@INC@, '@PRIO@', '@CAT@', '@THREAD@', '@MSG@', '@THROWABLE@', CURRENT_TIMESTAMP, 'user')"/> <param name="buffer" value="1"/> <param name="commit" value="true"/> <param name="quoteReplace" value="true"/> <param name="throwableMaxChars" value="2000"/> </appender> I want to replace the hardcoded 'user' value in the created_by field with the current user. Otherwise I can add a field for MDC/NDC in my table, as you said, and get the user name in that field. How can I do that? I have read that you can use %x in the conversion pattern and get the current user. How is this possible? Thanks & Regards Merin On 8/21/06, yaramaka reddy <[EMAIL PROTECTED]> wrote:
I think For this if u use MDC,NDC then u will get good results,,, From Suneel