org.csstudio.logging
Class LogConfigurator

java.lang.Object
  extended by org.csstudio.logging.LogConfigurator

public class LogConfigurator
extends java.lang.Object

Configurator for java.util.logging based on Eclipse preferences

Author:
Kay Kasemir

Method Summary
static void configureConsoleLogger(java.util.logging.Level level, java.util.logging.Formatter formatter)
          Configure all currently active loggers.
static void configureFileLogging(java.util.logging.Level level, java.lang.String file_pattern, int max_bytes, int max_files, java.util.logging.Formatter formatter)
          Configure a file logger When logging to multiple files, the first one will use the given filename.
static void configureFromPreferences()
          (Re-)Initialize logger from Eclipse preferences
static void configureJMSLogging(java.util.logging.Level level, java.lang.String jms_url, java.lang.String topic, java.util.logging.Formatter formatter)
          Configure a JMS logger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

configureFromPreferences

public static void configureFromPreferences()
                                     throws java.lang.Exception
(Re-)Initialize logger from Eclipse preferences

Throws:
java.lang.Exception - on error: Invalid preference values, errors during logger setup

configureConsoleLogger

public static void configureConsoleLogger(java.util.logging.Level level,
                                          java.util.logging.Formatter formatter)
Configure all currently active loggers. Ordinarily, that should be the root logger writing to the console, but additional handlers could already be in place via "lib/logging.properties" in the JRE directory or other means.

Parameters:
level -
formatter -

configureFileLogging

public static void configureFileLogging(java.util.logging.Level level,
                                        java.lang.String file_pattern,
                                        int max_bytes,
                                        int max_files,
                                        java.util.logging.Formatter formatter)
                                 throws java.lang.Exception
Configure a file logger When logging to multiple files, the first one will use the given filename. When that file is full, it's renamed to filename.1, and a new filename.0 is written.

Parameters:
level - Log level to use with file logging. Level.OFF to disable file logging
file_pattern - Base name of the file, ".0", ".1", ".2" will be added for multiple files
max_bytes - When file exceeds this size, a new file will be created
max_files - Number of files to use
Throws:
java.lang.Exception - on error: Cannot create new file, ...

configureJMSLogging

public static void configureJMSLogging(java.util.logging.Level level,
                                       java.lang.String jms_url,
                                       java.lang.String topic,
                                       java.util.logging.Formatter formatter)
                                throws java.lang.Exception
Configure a JMS logger

Parameters:
level - Log level. Level.OFF to disable JMS logging
jms_url - JMS server URL
topic - JMS topic
formatter - Formatter
Throws:
java.lang.Exception - on error