Results 1 to 2 of 2
  1. #1
    lowlyintern is offline Member
    Join Date
    Jun 2010
    Posts
    13
    Rep Power
    0

    Default Couple quick log4j questions

    First, if the threshold for an appender has been set and assigned to the rootLogger, is it possible to set the level of the same appender to a descendant with a lower level? For instance:

    Java Code:
    log4j.logger.com.mikel.smart.metrics.envfilters.SeaState=DEBUG, A1
    log4j.additivity.com.mikel.smart.metrics.envfilters.SeaState=False
    If appender A1 has threshold set to INFO, it will write to the appender but the level will be INFO instead of DEBUG.

    Second, after additivity has been set to false, is it possible to add multiple appenders back to a descendant with different threshold levels? For example, I know:

    Java Code:
    log4j.logger.com.mikel.smart.metrics.envfilters.SeaState=WARN, A1, A2
    Will add both A1 and A2 to the SeaState class at the WARN level, but what if I want A1 at DEBUG and A2 at WARN?

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    6

    Default

    I don't understand what you are asking for the first question, it is possible to have the root logger be set to level INFO by default and have an individual package be at DEBUG level, the messages should show up in the output as DEBUG. ?


    For different levels to more than one appender, I know this is possible in logback with the use of filters Chapter 6: Filters

    Where I have something written to two appenders and within each appender i have logic to only show if it of the specified level. this is to create separate error.log and debug.log files.

    But sorry, I don't know how to do this in log4j

Similar Threads

  1. Couple more questions on JAR Files :S
    By Lil_Aziz1 in forum New To Java
    Replies: 13
    Last Post: 06-05-2010, 09:44 AM
  2. Couple questions about Java
    By theadolescent in forum New To Java
    Replies: 3
    Last Post: 05-19-2010, 03:13 AM
  3. Couple Questions on Thread
    By Lil_Aziz1 in forum Threads and Synchronization
    Replies: 5
    Last Post: 01-06-2010, 03:02 PM
  4. Couple of questions regarding threading
    By exernet in forum New To Java
    Replies: 1
    Last Post: 12-15-2009, 01:23 PM
  5. Couple of newbie questions
    By ananasman in forum New To Java
    Replies: 11
    Last Post: 11-21-2008, 12:54 AM

Posting Permissions

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