Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*-
   * See the file LICENSE for redistribution information.
   *
   * Copyright (c) 2002, 2013 Oracle and/or its affiliates.  All rights reserved.
   *
   */
  
  package com.sleepycat.je.util;
  
 
JE instances of java.util.logging.Logger are configured to use this implementation of java.util.logging.FileHandler. By default, the handler's level is java.util.logging.Level.INFO To enable the console output, use the standard java.util.logging.LogManager configuration to set the desired level:
 com.sleepycat.je.util.FileHandler.level=INFO
 

The default destination for this output is a circular set of files named <environmentHome>/je.info.# The logging file size can be configured with standard java.util.logging.FileHandler configuration.

JE augments the java.util.logging API with a JE environment parameter for setting handler levels. This is described in greater detail in href="{@docRoot/../GettingStartedGuide/managelogging.html"> Chapter 12.Administering Berkeley DB Java Edition Applications}

See also:
Chapter 12. Logging
Using JE Trace Logging
 
 public class FileHandler extends java.util.logging.FileHandler {
 
     /*
      * The default ErrorManager will blindly write to stderr when it sees an
      * exception.  For instance, when we send an interrupt() to the Rep Node
      * we can see an InterruptedIOException written to stderr, but it never
      * gets passed to the caller.  For several tests, this causes irrelevant
      * stack traces to spew out even though no execption is ever thrown at us.
      * e.g.
      *
      * ------------- Standard Error -----------------
      * java.util.logging.ErrorManager: 2
      * java.io.InterruptedIOException
      *     at java.io.FileOutputStream.writeBytes(Native Method)
      *     at java.io.FileOutputStream.write(FileOutputStream.java:260)
      *     at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
      *     at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
      *     at java.util.logging.FileHandler$MeteredStream.flush(FileHandler.java:143)
      *     at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:278)
      *     at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:122)
      *     at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:212)        at java.util.logging.StreamHandler.flush(StreamHandler.java:225)        at java.util.logging.FileHandler.publish(FileHandler.java:556)
      *     at com.sleepycat.je.utilint.FileRedirectHandler.publish(FileRedirectHandler.java:54)
      *     at java.util.logging.Logger.log(Logger.java:458)
      *     at java.util.logging.Logger.doLog(Logger.java:480)
      *     at java.util.logging.Logger.log(Logger.java:503)
      *     at com.sleepycat.je.utilint.LoggerUtils.logMsg(LoggerUtils.java:343)
      *     at com.sleepycat.je.utilint.LoggerUtils.info(LoggerUtils.java:395)
      *     at com.sleepycat.je.rep.impl.node.FeederManager.runFeeders(FeederManager.java:449)
      *     at com.sleepycat.je.rep.impl.node.RepNode.run(RepNode.java:1198)
      */
     public static boolean STIFLE_DEFAULT_ERROR_MANAGER = false;
 
     /*
      * Using a JE specific handler lets us enable and disable output for the
      * entire library, and specify an environment specific format and level
      * default.
      */
     public FileHandler(String pattern,
                        int limit,
                        int count,
                        Formatter formatter,
                        EnvironmentImpl envImpl)
         throws SecurityExceptionIOException {
 
         super(patternlimitcounttrue /* append */);
 
             ErrorManager em = new ErrorManager() {
                     public void error(String msgException eint code) {
                         if () {
                             ..println
                                 ("FileHandler stifled exception: " + e);
                         } else {
                             super.error(msgecode);
                         }
                     }
                 };
             setErrorManager(em);
 
         /* Messages may be formatted with an environment specific tag. */
        setFormatter(formatter);
        Level level = LoggerUtils.getHandlerLevel
            (envImpl.getConfigManager(), .,
             getClass().getName() + ".level");
        setLevel(level);
    }
New to GrepCode? Check out our FAQ X