problem implementing log4j? not inserting data in new userlog.log other then server.log

Discussion in 'Java' started by vj, Dec 4, 2006.

  1. vj

    vj Guest

    problem implementing log4j? not inserting data in new userlog.log other
    then server.log

    <!-- A time/date based rolling appender -->
    <appender name="FILE"
    class="org.jboss.logging.appender.DailyRollingFileAppender">
    <errorHandler
    class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
    <param name="File"
    value="${jboss.server.home.dir}/log/server.log"/>
    <param name="Append" value="false"/>

    <!-- Rollover at midnight each day -->
    <param name="DatePattern" value="'.'yyyy-MM-dd"/>

    <!-- Rollover at the top of each hour
    <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
    -->

    <layout class="org.apache.log4j.PatternLayout">
    <!-- The default pattern: Date Priority [Category] Message\n
    -->
    <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>

    <!-- The full pattern: Date MS Priority [Category]
    (Thread:NDC) Message\n
    <param name="ConversionPattern" value="%d %-5r %-5p [%c]
    (%t:%x) %m%n"/>
    -->
    </layout>
    </appender>

    <!-- A time/date based rolling appender -->
    <appender name="USERLOGSFILE"
    class="org.jboss.logging.appender.DailyRollingFileAppender">
    <errorHandler
    class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
    <param name="File"
    value="${jboss.server.home.dir}/log/userlog.log"/>
    <param name="Append" value="false"/>

    <!-- Rollover at the top of each hour
    <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
    -->

    <layout class="org.apache.log4j.PatternLayout">
    <!-- The default pattern: Date Priority [Category] Message\n
    -->
    <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>

    <!-- The full pattern: Date MS Priority [Category]
    (Thread:NDC) Message\n
    <param name="ConversionPattern" value="%d %-5r %-5p [%c]
    (%t:%x) %m%n"/>
    -->
    </layout>
    </appender>


    <category name="UserActionsLogger">
    <priority value="INFO" />
    <appender-ref ref="USERLOGSFILE"/>
    </category>


    Why i am always getting error as
    2006-12-04 14:10:32,483 INFO [STDOUT] log4j:ERROR Could not create an
    Appender. Reported error follows.
    2006-12-04 14:10:32,483 INFO [STDOUT] java.lang.ClassCastException:
    org.jboss.logging.appender.DailyRollingFileAppender


    I don't understand this problem is from Log4j.jar or any class not
    getting initialized.

    I can get some data displayed in server.log if i use
    <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
    <errorHandler
    class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
    <param name="Target" value="System.out"/>
    <param name="Threshold" value="INFO"/>

    <layout class="org.apache.log4j.PatternLayout">
    <!-- The default pattern: Date Priority [Category] Message\n
    -->
    <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p
    [%c{1}] %m%n"/>
    </layout>
    </appender>


    But i need to get data in seperate file say userlog.log where have to
    fetch username with some more info is some standared format.

    Please guide me where the propblem is coming from.

    thanks
     
    vj, Dec 4, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alexandra Stehman

    eclipse, junit, log4j, & finding log4j.xml

    Alexandra Stehman, Jan 19, 2004, in forum: Java
    Replies:
    0
    Views:
    5,782
    Alexandra Stehman
    Jan 19, 2004
  2. Alex Hunsley
    Replies:
    2
    Views:
    12,946
    =?ISO-8859-15?Q?Fr=E9d=E9ric_G=E9din?=
    May 28, 2004
  3. Rodolfo
    Replies:
    0
    Views:
    959
    Rodolfo
    Jul 12, 2004
  4. unomystEz
    Replies:
    0
    Views:
    559
    unomystEz
    Nov 19, 2006
  5. Replies:
    0
    Views:
    297
Loading...

Share This Page