1 Reply Latest reply on Jan 29, 2013 6:22 PM by Tom Cunningham

    Logging into Database instead of file

    Ashok Rajendran Newbie

      Hi,

       

      I would like to persist the logs into database instead of file. I have done some of the changes based on my finding in jboss forum. but I couldn't achieve to write logs into database (oracle).  The changes which I have done are,

       

      Steps 1: Created the table into database (oracle) using below query

      CREATE TABLE LOGS (
                                                      logdate     Date,
                                                      priority    VARCHAR2(10),
                                                      category    VARCHAR2(35),
                                                      thread      VARCHAR2(20),
                                                      message     VARCHAR2(100))

       

       

      Step 2:  Added the below lines into jboss-log4j.xml

       

                    <appender name="jdbcAppender" class="org.apache.log4j.jdbc.JDBCAppender">

                     <param name="URL" value="jdbc:oracle:thin:localhost:1521:xe" />

                     <param name="Driver" value="oracle.jdbc.driver.OracleDriver" />

                    <param name="User" value="esb" />

                    <param name="Password" value="esb1234" />

                    <param name="Sql" value="INSERT INTO LOGS VALUES('%d','%-5p','%c','%t','%m')" /> 

                 </appender>

       

                  <category name="test.dblogger">

                     <priority value="INFO" />

                    <appender-ref ref="jdbcAppender"/>

                    <appender-ref ref="fileAppender"/>

                  </category>

       

       

      From the step 2, I am trying to log in both file and db, I could able to see the logs only in file but not in db. Anybody can guide me to resolve this issue..

       

       

      Thanks and Regards,

      Ashok