Package alluxio.util

Class LogUtils


  • @ThreadSafe
    public final class LogUtils
    extends java.lang.Object
    Utility methods for working with log.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int MAX_TRUNCATED_LENGTH
      The truncated length for a message line.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static LogInfo setLogLevel​(java.lang.String logName, java.lang.String level)
      Gets a logger's level with specify name, if the level argument is not null, it will set to specify level first.
      static java.lang.String truncateMessageLineLength​(java.lang.Object message)
      Truncates each line of a message to a certain length.
      static java.lang.String truncateMessageLineLength​(java.lang.Object message, int maxLineLength)
      Truncates each line of a message to a certain length.
      static void warnWithException​(org.slf4j.Logger logger, java.lang.String message, java.lang.Object... args)
      Log a warning message with full exception if debug logging is enabled, or just the exception string otherwise.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MAX_TRUNCATED_LENGTH

        public static final int MAX_TRUNCATED_LENGTH
        The truncated length for a message line.
        See Also:
        Constant Field Values
    • Method Detail

      • setLogLevel

        public static LogInfo setLogLevel​(java.lang.String logName,
                                          java.lang.String level)
                                   throws java.io.IOException
        Gets a logger's level with specify name, if the level argument is not null, it will set to specify level first.
        Parameters:
        logName - logger's name
        level - logger's level
        Returns:
        an entity object about the log info
        Throws:
        java.io.IOException - if an I/O error occurs
      • warnWithException

        public static void warnWithException​(org.slf4j.Logger logger,
                                             java.lang.String message,
                                             java.lang.Object... args)
        Log a warning message with full exception if debug logging is enabled, or just the exception string otherwise.
        Parameters:
        logger - the logger to be used
        message - the message to be logged
        args - the arguments for the message
      • truncateMessageLineLength

        public static java.lang.String truncateMessageLineLength​(java.lang.Object message)
        Truncates each line of a message to a certain length.
        Parameters:
        message - the message to truncate the lines for
        Returns:
        the message, with lines truncated to length MAX_TRUNCATED_LENGTH
      • truncateMessageLineLength

        public static java.lang.String truncateMessageLineLength​(java.lang.Object message,
                                                                 int maxLineLength)
        Truncates each line of a message to a certain length.
        Parameters:
        message - the message to truncate the lines for
        maxLineLength - the maximum length of a message line
        Returns:
        the message, with lines truncated to the specified length