Results 1 to 2 of 2
  1. #1
    kkd
    kkd is offline Member
    Join Date
    Jan 2011
    Posts
    2
    Rep Power
    0

    Default AsyncAppender in log4j

    Hi Guys,

    In my application, am using AsyncAppender to log only Error's from a class(com.uk.test.Test) to database.
    Here is the extract from my log4j.xml

    {code}
    <appender name="LOG_TO_DATABASE" class="org.apache.log4j.jdbc.JDBCAppender">
    <param name="URL"
    value="jdbc:jtds:sybase://test.uk.com:5000/TestDB" />
    <param name="Driver" value="net.sourceforge.jtds.jdbc.Driver" />
    <param name="User" value="admin" />
    <param name="Password" value="admin" />
    <layout class="org.apache.log4j.PatternLayout">
    <param name="ConversionPattern"
    value="INSERT INTO LOGS VALUES('%d{dd MMM yyyy HH:mm:ss}','%C','%p','%m')" />
    </layout>
    </appender>

    <appender name="ASYNC_LOG_TO_DB" class="org.apache.log4j.AsyncAppender">
    <param name="BufferSize" value="2000"/>
    <appender-ref ref="LOG_TO_DATABASE"/>
    </appender>


    <category name="com.uk.test.Test">
    <priority value="ERROR" />
    <appender-ref ref="ASYNC_LOG_TO_DB" />
    </category>
    {/code}
    It logs to database except logger(fully qualified class name of the caller issuing the logging request).. Any ideas much appreciated..

    However if I don't use AsyncAppender and just use JDBCAppender, all works fine... It even logs the logger(fully qualified class name of the caller issuing the logging request)..

    Any ideas how I could get AsyncAppender to log even the class name which is issuing the loggin request..

    Thanks
    K

  2. #2
    kkd
    kkd is offline Member
    Join Date
    Jan 2011
    Posts
    2
    Rep Power
    0

Similar Threads

  1. log4j
    By haj1st in forum Eclipse
    Replies: 5
    Last Post: 01-23-2011, 02:17 PM
  2. Replies: 1
    Last Post: 09-20-2010, 08:32 AM
  3. log4j
    By swapna_d in forum New To Java
    Replies: 7
    Last Post: 08-04-2010, 12:23 AM
  4. Regarding Log4j
    By sidiq in forum New To Java
    Replies: 0
    Last Post: 04-07-2008, 07:35 PM
  5. Log4j
    By chakri in forum New To Java
    Replies: 1
    Last Post: 02-08-2008, 10:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •