Apache JMeter

org.apache.jorphan.logging
Class LoggingManager

java.lang.Object
  extended by org.apache.jorphan.logging.LoggingManager

public final class LoggingManager
extends Object

Manages JMeter logging


Field Summary
static String DEFAULT_PATTERN
           
static String LOG_FILE
           
static String LOG_PRIORITY
           
 
Method Summary
static void addLogTargetToRootLogger(org.apache.log.LogTarget[] logTargets)
          Add logTargets to root logger FIXME What's the clean way to add a LogTarget afterwards ?
static org.apache.log.Logger getLoggerFor(String category)
          Get the Logger for a class.
static org.apache.log.Logger getLoggerForClass()
          Get the Logger for a class - no argument needed because the calling class name is derived automatically from the call stack.
static org.apache.log.Logger getLoggerForShortName(String category)
          Get the Logger for a class.
static void initializeLogging(Properties properties)
          Initialise the logging system from the Jmeter properties.
static String removePrefix(String name)
          Removes the standard prefix, i.e.
static void setLoggingLevels(Properties appProperties)
          Handle LOG_PRIORITY.category=priority and LOG_FILE.category=file_name properties.
static void setPriority(org.apache.log.Priority priority)
          Set the default logging priority.
static void setPriority(org.apache.log.Priority priority, String category)
          Set the logging priority for a category.
static void setPriority(String p)
           
static void setPriority(String priority, String category)
          Set the logging priority for a category.
static void setPriorityFullName(String priority, String fullName)
          Set the logging priority for a category.
static void setTarget(org.apache.log.LogTarget target, String category)
          Set the logging target for a category.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PATTERN

public static final String DEFAULT_PATTERN
See Also:
Constant Field Values

LOG_FILE

public static final String LOG_FILE
See Also:
Constant Field Values

LOG_PRIORITY

public static final String LOG_PRIORITY
See Also:
Constant Field Values
Method Detail

initializeLogging

public static void initializeLogging(Properties properties)
Initialise the logging system from the Jmeter properties. Logkit loggers inherit from their parents. Normally the jmeter properties file defines a single log file, so set this as the default from "log_file", default "jmeter.log" The default priority is set from "log_level", with a default of INFO

Parameters:
properties - Properties to be used for initialization

setLoggingLevels

public static void setLoggingLevels(Properties appProperties)
Handle LOG_PRIORITY.category=priority and LOG_FILE.category=file_name properties. If the prefix is detected, then remove it to get the category.

Parameters:
appProperties - Properties that contain the LOG_PRIORITY and LOG_FILE prefixed entries

removePrefix

public static String removePrefix(String name)
Removes the standard prefix, i.e. "org.apache.".

Parameters:
name - from which to remove the prefix
Returns:
the name with the prefix removed

getLoggerForClass

public static org.apache.log.Logger getLoggerForClass()
Get the Logger for a class - no argument needed because the calling class name is derived automatically from the call stack.

Returns:
Logger

getLoggerFor

public static org.apache.log.Logger getLoggerFor(String category)
Get the Logger for a class.

Parameters:
category - - the full name of the logger category
Returns:
Logger

getLoggerForShortName

public static org.apache.log.Logger getLoggerForShortName(String category)
Get the Logger for a class.

Parameters:
category - - the full name of the logger category, this will have the prefix removed.
Returns:
Logger

setPriority

public static void setPriority(String priority,
                               String category)
Set the logging priority for a category.

Parameters:
priority - - string containing the priority name, e.g. "INFO", "WARN", "DEBUG", "FATAL_ERROR"
category - - string containing the category

setPriorityFullName

public static void setPriorityFullName(String priority,
                                       String fullName)
Set the logging priority for a category.

Parameters:
priority - - priority, e.g. DEBUG, INFO
fullName - - e.g. org.apache.jmeter.etc, will have the prefix removed.

setPriority

public static void setPriority(org.apache.log.Priority priority,
                               String category)
Set the logging priority for a category.

Parameters:
priority - - e.g. Priority.DEBUG
category - - string containing the category

setPriority

public static void setPriority(String p)

setPriority

public static void setPriority(org.apache.log.Priority priority)
Set the default logging priority.

Parameters:
priority - e.g. Priority.DEBUG

setTarget

public static void setTarget(org.apache.log.LogTarget target,
                             String category)
Set the logging target for a category.

Parameters:
target - the LogTarget
category - the category name

addLogTargetToRootLogger

public static void addLogTargetToRootLogger(org.apache.log.LogTarget[] logTargets)
Add logTargets to root logger FIXME What's the clean way to add a LogTarget afterwards ?

Parameters:
logTargets - LogTarget array

Apache JMeter

Copyright © 1998-2015 Apache Software Foundation. All Rights Reserved.