Class Logging

java.lang.Object
org.noise_planet.noisemodelling.webserver.utilities.Logging

public class Logging extends Object
Utility functions related to logging features
  • Field Details

    • DEFAULT_LOG_FORMAT

      public static final String DEFAULT_LOG_FORMAT
      See Also:
    • LOG_PATTERN

      public static final Pattern LOG_PATTERN
    • LINE_SEPARATOR

      public static final String LINE_SEPARATOR
  • Constructor Details

    • Logging

      public Logging()
  • Method Details

    • initConsoleLogging

      public static void initConsoleLogging()
    • configureLoggerFromWorkingDirectory

      public static void configureLoggerFromWorkingDirectory(String workingDirectory, String loggingFileName, boolean verbose)
    • clearAppenders

      public static void clearAppenders()
    • createRollingFileAppender

      @NotNull public static org.apache.log4j.RollingFileAppender createRollingFileAppender(String workingDirectory, String loggingFileName)
    • formatThrowableAsHtml

      public static String formatThrowableAsHtml(Throwable throwable)
      Build an HTML-friendly stack trace string similar to what SLF4J would print, including the exception type, message, stack frames, causes, and suppressed exceptions.
    • appendSuppressed

      public static void appendSuppressed(StringBuilder sb, Throwable sup, IdentityHashMap<Throwable, Boolean> seen, String prefix)
    • formatSqlQueryResult

      public static String formatSqlQueryResult(groovy.sql.Sql sql, Object query)
      Executes a SQL query and return the result set as an ASCII table.
      Parameters:
      sql - An instance of groovy.sql.Sql
      query - A String or GString (allows for parameter injection)
    • formatSqlQueryResult

      public static String formatSqlQueryResult(groovy.sql.Sql sql, Object query, int maxColWidth)
      Executes a SQL query and return the result set as an ASCII table.
      Parameters:
      sql - An instance of groovy.sql.Sql
      query - A String or GString (allows for parameter injection)
      maxColWidth - Maximum width of a column before truncation