Class JulLog

All Implemented Interfaces:
LogInterface

public class JulLog extends GenericLog implements LogInterface
An implementation of LogInterface that routes every message to java.util.logging (JUL), the logging framework built into the JDK. Unlike the historical JavaLog (shipped separately so the library could stay Java 1.2/1.3 compatible), this backend lives directly in com.mcpdbwizard.pub and needs no extra jar — JUL is part of the JDK.

The five LogInterface severities map onto JUL levels as follows. JUL has no level above SEVERE, so both error and syserror use it:

LogInterface severity to java.util.logging level mapping
LogInterfacejava.util.logging.Level
debugFINE
infoINFO
warningWARNING
errorSEVERE
syserrorSEVERE

The isModal and isLogged flags carried by the detailed LogInterface methods are accepted and ignored: JUL has no modal-dialog concept, and whether a message is actually written is decided by the JUL configuration (usually $JAVA_HOME/conf/logging.properties), not by this class. Debug messages additionally honour GenericLog.debugOn() / GenericLog.debugOff() (off by default), matching the other LogInterface implementations. If debug messages are not appearing, check the JUL configuration for a .level entry and set it to FINE or ALL.

The exception-taking error/syserror methods pass the Throwable straight to JUL, so the handler records the full stack trace rather than just the message text.

See LogInterface

Copyright 2003-2026 ATB Consultancy Services Ltd (formerly Orinda Software Ltd, Dublin, Ireland)

Version:
7
Author:
[email protected]
  • Constructor Details

    • JulLog

      public JulLog()
      Create an instance of JulLog backed by a logger named after this class.
    • JulLog

      public JulLog(String loggerName)
      Create an instance of JulLog backed by a logger with the given name.
      Parameters:
      loggerName - the JUL logger name to use. This should be a dot-separated name, normally based on the package or class name of the subsystem.
    • JulLog

      public JulLog(Class<?> clazz)
      Create an instance of JulLog backed by a logger named after the given class.
      Parameters:
      clazz - the class whose name is used as the JUL logger name.
    • JulLog

      public JulLog(Logger logger)
      Create an instance of JulLog that wraps an existing JUL logger.
      Parameters:
      logger - the Logger to route messages through.
  • Method Details

    • getLogger

      public Logger getLogger()
      Return the underlying JUL logger.
      Returns:
      the Logger messages are routed through.
    • writeMessage

      protected void writeMessage(String messageType, String messageText, boolean isModal, boolean isLogged)
      Route a formatted message to the JUL level that corresponds to its severity. JUL applies its own level filtering, so a message emitted here may still be discarded downstream.
      Specified by:
      writeMessage in class GenericLog
      Parameters:
      messageType - one of the DEBUG, INFO, WARN, ERROR or SYSERR constants defined in LogInterface.
      messageText - the message text.
      isModal - ignored; JUL has no modal-dialog concept.
      isLogged - ignored; the JUL configuration decides what is written.
    • error

      public void error(Exception theException, boolean isModal, boolean isLogged)
      Log an error at SEVERE, passing the exception to JUL so the full stack trace is recorded.
      Specified by:
      error in interface LogInterface
      Overrides:
      error in class GenericLog
      Parameters:
      theException - the exception to log.
      isModal - ignored; JUL has no modal-dialog concept.
      isLogged - ignored; the JUL configuration decides what is written.
    • syserror

      public void syserror(Exception theException, boolean isModal, boolean isLogged)
      Log a serious error at SEVERE, passing the exception to JUL so the full stack trace is recorded.
      Specified by:
      syserror in interface LogInterface
      Overrides:
      syserror in class GenericLog
      Parameters:
      theException - the exception to log.
      isModal - ignored; JUL has no modal-dialog concept.
      isLogged - ignored; the JUL configuration decides what is written.
    • flush

      public void flush()
      Required by LogInterface but not used: JUL handlers manage their own flushing.
      Specified by:
      flush in interface LogInterface
      Specified by:
      flush in class GenericLog
    • getCurrentLog

      public String getCurrentLog()
      Returns the name of the JUL logger messages are routed through.
      Specified by:
      getCurrentLog in interface LogInterface
      Specified by:
      getCurrentLog in class GenericLog
      Returns:
      the JUL logger name (not a file path; the actual destination is determined by the JUL configuration and its handlers).