org.ccnx.ccn.impl.support.Log Class Reference

Wrapper for the standard java.util Logging classes. More...

List of all members.

Static Public Member Functions

static String getApplicationClass ()
static String getApplicationClass (int facility)
static void exitApplication ()
static void abort ()
static void info (String msg, Object...params)
 Logs message with level = info.
static void info (int facility, String msg, Object...params)
static void warning (String msg, Object...params)
 Logs message with level = warning.
static void warning (int facility, String msg, Object...params)
static void severe (String msg, Object...params)
 Logs message with level = severe.
static void severe (int facility, String msg, Object...params)
static void fine (String msg, Object...params)
 Logs message with level = fine.
static void fine (int facility, String msg, Object...params)
static void finer (String msg, Object...params)
 Logs message with level = finer.
static void finer (int facility, String msg, Object...params)
static void finest (String msg, Object...params)
 Logs message with level = finest.
static void finest (int facility, String msg, Object...params)
static void setLevel (Level l)
static void setLevel (int facility, Level l)
static void setLevels (Level[] levels)
static void setDefaultLevel (Level l)
 Set the default log level that will be in effect unless overridden by the system property.
static void setDefaultLevel (int facility, Level l)
static void setLogLevels ()
 Set the facility log levels based on the defaults and system overrides.
static Level getLevel ()
 Gets the current log level.
static Level getLevel (int facility)
 Gets the current log level.
static Level[] getLevels ()
 Returns a copy of the array of all log levels.
static boolean isLoggable (Level level)
 Would the given log level write to the log?
static boolean isLoggable (int facility, Level level)
 Would the given log level write to the log?
static boolean setTimestamp (boolean enableTimestamp)
 Set flag for enabling/disabling timestamps on all messages.
static void log (Level l, String msg, Object...params)
 The main logging wrapper.
static void log (int facility, Level l, String msg, Object...params)
static void flush ()
static void warningStackTrace (Throwable t)
static void warningStackTrace (int facility, Throwable t)
static void infoStackTrace (Throwable t)
static void infoStackTrace (int facility, Throwable t)
static void logStackTrace (Level level, Throwable t)
static void logStackTrace (int facility, Level level, Throwable t)
static void logException (String message, Exception e)
static void logException (int facility, Level level, String message, Exception e)

Static Public Attributes

static final String DEFAULT_APPLICATION_CLASS
 Allow override on command line or from configuration file.
static final String DEFAULT_LOG_FILE = "ccn_"
static final String DEFAULT_LOG_SUFFIX = ".log"
static final String DEFAULT_LOG_LEVEL_PROPERTY = "org.ccnx.ccn.LogLevel"
 Properties and environment variables to set log parameters.
static final String DEFAULT_LOG_LEVEL_ENV = "CCN_LOG_LEVEL"
static final String LOG_DIR_PROPERTY = "org.ccnx.ccn.LogDir"
static final String LOG_DIR_ENV = "CCN_LOG_DIR"
static final int FAC_ALL = 0
static final int FAC_DEFAULT = 1
static final int FAC_PIPELINE = 2
static final int FAC_NETMANAGER = 3
static final int FAC_USER0 = 4
static final int FAC_USER1 = 5
static final int FAC_USER2 = 6
static final int FAC_USER3 = 7
static final int FAC_ACCESSCONTROL = 8
static final int FAC_REPO = 9
static final int FAC_TIMING = 10
static final int FAC_TRUST = 11
static final int FAC_KEYS = 12
static final int FAC_ENCODING = 13
static final int FAC_IO = 14
static final int FAC_SIGNING = 15
static final int FAC_VERIFY = 16
static final int FAC_USER4 = 17
static final int FAC_USER5 = 18
static final int FAC_USER6 = 19
static final int FAC_USER7 = 20
static final int FAC_USER8 = 21
static final int FAC_USER9 = 22
static final int FAC_USER10 = 23
static final int FAC_USER11 = 24
static final int FAC_USER12 = 25
static final int FAC_USER13 = 26
static final int FAC_USER14 = 27
static final int FAC_USER15 = 28
static final int FAC_TEST = 29
static final String[] FAC_LOG_LEVEL_PROPERTY
static final String[] FAC_LOG_LEVEL_ENV
static final Level[] FAC_LOG_LEVEL_DEFAULT

Static Protected Member Functions

static void doLog (int facility, Level l, String msg, Object...params)

Static Protected Attributes

static final int offValue = Level.OFF.intValue()
static Logger _systemLogger = null
static Logger[] _facilityLoggers = null
static final String[] FAC_NAME
static Level[] _fac_level = new Level[FAC_LOG_LEVEL_PROPERTY.length]
static int[] _fac_value = new int[FAC_LOG_LEVEL_PROPERTY.length]
static boolean _timestamp = false

Static Package Functions

 [static initializer]


Detailed Description

Wrapper for the standard java.util Logging classes.

This allows log messages which will not actually be output due to being at a lower level than the current logging level to not affect performance by performing expensive calculations to compute their parameters.

To send log entries to file, specify the log output directory using either the system property org.ccnx.ccn.LogDir or the environment variable CCN_LOG_DIR. To override the default log level for whatever program you are running, set the system property org.ccnx.ccn.LogLevel.


Member Function Documentation

static void org.ccnx.ccn.impl.support.Log.info ( String  msg,
Object...  params 
) [static]

Logs message with level = info.

See also:
Log.log(Level, String, Object...)

static void org.ccnx.ccn.impl.support.Log.warning ( String  msg,
Object...  params 
) [static]

Logs message with level = warning.

See also:
Log.log(Level, String, Object...)

static void org.ccnx.ccn.impl.support.Log.severe ( String  msg,
Object...  params 
) [static]

Logs message with level = severe.

See also:
Log.log(Level, String, Object...)

static void org.ccnx.ccn.impl.support.Log.fine ( String  msg,
Object...  params 
) [static]

Logs message with level = fine.

See also:
Log.log(Level, String, Object...)

static void org.ccnx.ccn.impl.support.Log.finer ( String  msg,
Object...  params 
) [static]

Logs message with level = finer.

See also:
Log.log(Level, String, Object...)

static void org.ccnx.ccn.impl.support.Log.finest ( String  msg,
Object...  params 
) [static]

Logs message with level = finest.

See also:
Log.log(Level, String, Object...)

static void org.ccnx.ccn.impl.support.Log.setDefaultLevel ( Level  l  )  [static]

Set the default log level that will be in effect unless overridden by the system property.

Use of this method allows a program to change the default logging level while still allowing external override by the user at runtime.

This must be called before using setLevel(). Calling this method will reset all log levels to the default or to the system property level.

Parameters:
l the new default level

static Level org.ccnx.ccn.impl.support.Log.getLevel (  )  [static]

Gets the current log level.

Returns:

static Level org.ccnx.ccn.impl.support.Log.getLevel ( int  facility  )  [static]

Gets the current log level.

Returns:
may be null if invalid facility number

static Level [] org.ccnx.ccn.impl.support.Log.getLevels (  )  [static]

Returns a copy of the array of all log levels.

The 0 element (FAC_ALL) will be null.

static boolean org.ccnx.ccn.impl.support.Log.isLoggable ( Level  level  )  [static]

Would the given log level write to the log?

Parameters:
level 
Returns:
true means would write log

static boolean org.ccnx.ccn.impl.support.Log.isLoggable ( int  facility,
Level  level 
) [static]

Would the given log level write to the log?

Parameters:
level 
Returns:
true means would write log

static void org.ccnx.ccn.impl.support.Log.log ( Level  l,
String  msg,
Object...  params 
) [static]

The main logging wrapper.

Allows for variable parameters to the message. Using the variable parameters here rather then constructing the message yourself helps reduce CPU load when logging is disabled. (Since the params do not have their .toString() methods called if the message is not logged).

Parameters:
l Log level.
msg Message or format string. Note that to improve performance, only the simplest form of of MessageFormat, i.e. {0}, {1}, {2}... is supported
See also:
java.text.MessageFormat
Parameters:
params 


Member Data Documentation

Initial value:

                "ccnx"
Allow override on command line or from configuration file.


The documentation for this class was generated from the following file:

Generated on Thu Feb 16 00:45:00 2012 for Content-Centric Networking in Java by  doxygen 1.5.6