public class

GlobalLog

extends Object
java.lang.Object
   ↳ com.pnfsoftware.jeb.util.logging.GlobalLog

Class Overview

Global logging facility used by JEB. This class offers methods to create per-class loggers. Upon initialization, a JEB client should add destination streams and buffers.

Implementation note: The official RCP client implementation provided with JEB registers stdout as well as the UI console window as destinations.

This class is thread-safe. However, ILogger instances returned by getLogger() are not thread-safe.

How to use:

 import com.pnfsoftware.jeb.util.logging.ILogger;
 import com.pnfsoftware.jeb.util.loggingg.GlobalLog;
 
 class Xyz {
     private static final ILogger logger = GlobalLog.getLogger(Xyz.class);
     ...
 }
 

Summary

Constants
int LEVEL_ALL
int LEVEL_CATCHING
int LEVEL_DEBUG
int LEVEL_DISABLED
int LEVEL_ERROR
int LEVEL_INFO
int LEVEL_STATUS
int LEVEL_TRACE
int LEVEL_WARN
Public Constructors
GlobalLog()
Public Methods
synchronized static void addDestinationBuffer(List<CharSequence> buffer)
Add a destination buffer to the list of log message recipients.
synchronized static void addDestinationStream(PrintStream out)
Add a destination stream to the list of log message recipients.
synchronized static void addGlobalFilter(String pattern, int requiredLevel)
synchronized static void addStatusSink(LogStatusSink sink)
static void catching(ILogger logger, Throwable t)
static void catchingDebug(ILogger logger, Throwable t)
synchronized static void clearGlobalFilters()
synchronized static List<List<CharSequence>> getDestinationBuffers()
Get the list of destination buffers.
synchronized static List<PrintStream> getDestinationStreams()
Get the list of destination streams.
synchronized static int getEnabledLevel()
Get the default logging level.
synchronized static ILogger getInternalLogger(Class<?> clazz)
Create or retrieve an internal logger.
synchronized static ILogger getLogger(Class<?> clazz, int level)
Create or retrieve a logger attached to and named after a given class.
synchronized static ILogger getLogger(Class<?> clazz)
Create or retrieve a logger attached to and named after a given class.
synchronized static ILogger getLogger()
Create or retrieve the anonymous logger.
synchronized static ILogger getLogger(String name, int level)
Create or retrieve a named logger.
synchronized static List<LogStatusSink> getStatusSinks()
synchronized static boolean isGloballyDisabled(ILogger logger)
synchronized static void removeDestinationBuffer(List<CharSequence> buffer)
Remove a destination buffer.
synchronized static void removeDestinationStream(PrintStream out)
Remove a destination stream.
synchronized static void removeGlobalFilter(String pattern)
synchronized static void removeStatusSink(LogStatusSink sink)
synchronized static void setEnabledLevel(int level, boolean updateExistingLoggers)
synchronized static void setEnabledLevel(int level)
Set the default logging level
synchronized static void status(String format, Object... params)
Convenience method for getLogger().status(...).
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int LEVEL_ALL

Constant Value: 0 (0x00000000)

public static final int LEVEL_CATCHING

Constant Value: 60 (0x0000003c)

public static final int LEVEL_DEBUG

Constant Value: 20 (0x00000014)

public static final int LEVEL_DISABLED

Constant Value: 2147483647 (0x7fffffff)

public static final int LEVEL_ERROR

Constant Value: 50 (0x00000032)

public static final int LEVEL_INFO

Constant Value: 30 (0x0000001e)

public static final int LEVEL_STATUS

Constant Value: 100 (0x00000064)

public static final int LEVEL_TRACE

Constant Value: 10 (0x0000000a)

public static final int LEVEL_WARN

Constant Value: 40 (0x00000028)

Public Constructors

public GlobalLog ()

Public Methods

public static synchronized void addDestinationBuffer (List<CharSequence> buffer)

Add a destination buffer to the list of log message recipients. The list implementation must be thread-safe: it should be an object returned by Collections.synchronizedList()

Parameters
buffer the thread-safe buffer

public static synchronized void addDestinationStream (PrintStream out)

Add a destination stream to the list of log message recipients.

Parameters
out a destination stream

public static synchronized void addGlobalFilter (String pattern, int requiredLevel)

public static synchronized void addStatusSink (LogStatusSink sink)

public static void catching (ILogger logger, Throwable t)

public static void catchingDebug (ILogger logger, Throwable t)

public static synchronized void clearGlobalFilters ()

public static synchronized List<List<CharSequence>> getDestinationBuffers ()

Get the list of destination buffers.

Returns
  • the list of destination buffers

public static synchronized List<PrintStream> getDestinationStreams ()

Get the list of destination streams.

Returns
  • the list of destination streams

public static synchronized int getEnabledLevel ()

Get the default logging level.

Returns
  • the default logging level

public static synchronized ILogger getInternalLogger (Class<?> clazz)

Create or retrieve an internal logger. INTERNAL USAGE ONLY.

public static synchronized ILogger getLogger (Class<?> clazz, int level)

Create or retrieve a logger attached to and named after a given class.

Parameters
clazz class reference
level the cut-off level
Returns
  • the logger

public static synchronized ILogger getLogger (Class<?> clazz)

Create or retrieve a logger attached to and named after a given class. If created, the logging level is set to the default global logging level.

Parameters
clazz class reference
Returns
  • the logger

public static synchronized ILogger getLogger ()

Create or retrieve the anonymous logger. If created, the logging level is set to the default global logging level.

Returns
  • the anonymous logger

public static synchronized ILogger getLogger (String name, int level)

Create or retrieve a named logger.

Parameters
name logger name
level the cut-off level
Returns
  • the logger

public static synchronized List<LogStatusSink> getStatusSinks ()

Returns
  • the list of status sinks

public static synchronized boolean isGloballyDisabled (ILogger logger)

public static synchronized void removeDestinationBuffer (List<CharSequence> buffer)

Remove a destination buffer.

Parameters
buffer the destination buffer

public static synchronized void removeDestinationStream (PrintStream out)

Remove a destination stream.

Parameters
out the destination stream

public static synchronized void removeGlobalFilter (String pattern)

public static synchronized void removeStatusSink (LogStatusSink sink)

public static synchronized void setEnabledLevel (int level, boolean updateExistingLoggers)

public static synchronized void setEnabledLevel (int level)

Set the default logging level

Parameters
level the default logging level

public static synchronized void status (String format, Object... params)

Convenience method for getLogger().status(...).