Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Custom Level Threshold Ignored

Status
Not open for further replies.

JamieCash

Programmer
Mar 24, 2006
1
GB
I have created a custom level that works as far as logging is concerned, but is ignored when set as a threshold.

The level is defined as follows:
Code:
public class BusinessLevel extends Level
{
  //Business Level Integer Values
  public static final int BUSINESS_INT = FATAL_INT + 10000;
  
  //Business Levels
  public static final Level BUSINESS = new BusinessLevel(BUSINESS_INT, "BUSINESS", SyslogAppender.LOG_LOCAL0);
  
  /**
   * Constructor
   * 
   * @param level
   * @param levelStr
   * @param syslogEquivalent
   */
  public BusinessLevel(int level, String levelStr, int syslogEquivalent)
  {
    super(level, levelStr, syslogEquivalent);
  }
}
When I set the threshold to fatal, both fatal and business errors are logged. This is correct. But when I set the threshold to business, all levels are logged.

My appender config is as follows:
Code:
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
      <param name="Target" value="System.out"/>
			<param name="Threshold" value="BUSINESS#BusinessLevel"/>
      <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>
What am I doing wrong?

Any help would be much apprecieated.

Regards

Jamie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top