de.esprit.common.log

## Class LogChannelCache

- java.lang.Object
- - de.esprit.common.log.LogChannelCache

-     public class LogChannelCache
      extends java.lang.Object

  This is a cache for keeping a set of LogChannels that can be accessed by name.

  #### Coding examples

  Here is a sample code that opens a LogChannel for the DBObject output. This channel is configured to report to three outputs (`LogPrinter` objects): the system-console, a log-file and a GUI log-frame. Note that each output can be configured individually with respect to the log-level and message formatting.

       // sample tracing for the DBO log channel
       LogChannel logCh = Log.getLogChannel("DBO");
       logCh.setLogLevel(DUMP);

       LogPrinterConsole logConsole = logCh.openConsole();
       logConsole.setLogLevel(ERROR);

       LogPrinterFile logFile = logCh.openLogFile(logDir);
       logFile.setLogLevel(VERBOSE);

       LogPrinterFrame logFrame = logCh.openLogFrame("DBO-Log");
       logFrame.setLogLevel(LOG_INFO);
       logFrame.registerForExit(this);

       logCh.logInfo(this, "");

  Author:
    Rainer Buesch

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LogChannelCache()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `close()` Closes all cached LogChannels and removes them from the cache.
    `static void` | `closeLogChannel(java.lang.String channelName)` Closes the named log channel by removing it from the cached list.
    `static LogChannel` | `getLogChannel(java.lang.String channelName)` Opens a named channel for sending messages to.
    `static boolean` | `hasLogChannel(java.lang.String channelName)` Tells whether a LogChannel with this name exists already.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### LogChannelCache

          public LogChannelCache()

  - ### Method Detail

    - #### getLogChannel

          public static LogChannel getLogChannel(java.lang.String channelName)

      Opens a named channel for sending messages to. if the channel doesn't exist yet it will be created and cached in an internal list for reusage.

    - #### hasLogChannel

          public static boolean hasLogChannel(java.lang.String channelName)

      Tells whether a LogChannel with this name exists already.

    - #### closeLogChannel

          public static void closeLogChannel(java.lang.String channelName)

      Closes the named log channel by removing it from the cached list. The underlying LogHandler is also closed and thus releases it's resources.

    - #### close

          public static void close()

      Closes all cached LogChannels and removes them from the cache.

Copyright © 2012 EsprIT-Systems. All Rights Reserved.