intarsys runtime library

de.intarsys.tools.logging
Class LogTools

java.lang.Object
  extended by de.intarsys.tools.logging.LogTools

public class LogTools
extends Object

Tool methods to ease life with java.util.logging.


Field Summary
static String INDENT
           
 
Method Summary
static void closeFileLogger(Logger logger)
          Closes a fileLogger.
static Logger createFileLogger(String id, String filePattern, boolean append)
          Creates a fileLogger.
static void dumpLogFiles()
          This method tries to create a dump of all active log files.
static List<String> dumpObject(String prefix, Object object)
           
static List<String> dumpObject(String prefix, Object object, IDumpObject details)
           
static File[] getFiles(Handler handler)
           
static File[] getFilesThreadLocal()
           
static Logger getLogger(Class<?> clazz)
          Get a logger that corresponds to clazz.
static Logger getLogger(String name)
          Get a logger for name name.
static void reconfigure(ClassLoader classloader, String resource)
           
static void setFileHandlerLevel(Logger logger, Level newLevel)
           
static String toLoggerName(Class<?> clazz)
          The name we want to use for a logger used in clazz.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INDENT

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

closeFileLogger

public static void closeFileLogger(Logger logger)
Closes a fileLogger.


createFileLogger

public static Logger createFileLogger(String id,
                                      String filePattern,
                                      boolean append)
                               throws SecurityException,
                                      IOException
Creates a fileLogger.

Returns:
A Logger named with 'id'.
Throws:
IOException
SecurityException

dumpLogFiles

public static void dumpLogFiles()
This method tries to create a dump of all active log files. For this to work you need a FileDumpHandler attached to the root logger.


dumpObject

public static List<String> dumpObject(String prefix,
                                      Object object)

dumpObject

public static List<String> dumpObject(String prefix,
                                      Object object,
                                      IDumpObject details)

getFiles

public static File[] getFiles(Handler handler)

getFilesThreadLocal

public static File[] getFilesThreadLocal()

getLogger

public static Logger getLogger(Class<?> clazz)
Get a logger that corresponds to clazz.

Parameters:
clazz - The class object we want a logger for.
Returns:
A Logger that corresponds to clazz.

getLogger

public static Logger getLogger(String name)
Get a logger for name name.

Parameters:
name - The logger name/category
Returns:
Get a logger for name name.

reconfigure

public static void reconfigure(ClassLoader classloader,
                               String resource)

setFileHandlerLevel

public static void setFileHandlerLevel(Logger logger,
                                       Level newLevel)

toLoggerName

public static String toLoggerName(Class<?> clazz)
The name we want to use for a logger used in clazz. This implementation uses the package name.

Parameters:
clazz - The class object we want a name for.
Returns:
The name we want to use for a logger used in clazz.

intarsys runtime library

Copyright © 2012 intarsys consulting GmbH. All Rights Reserved.