Class Source

java.lang.Object
org.apache.logging.log4j.core.util.Source
Direct Known Subclasses:
LastModifiedSource

public class Source extends Object
Represents the source for the logging configuration as an immutable object.
  • Field Details

    • LOGGER

      private static final Logger LOGGER
    • file

      private final File file
    • uri

      private final URI uri
    • location

      private final String location
  • Constructor Details

    • Source

      public Source(ConfigurationSource source)
      Constructs a Source from a ConfigurationSource.
      Parameters:
      source - The ConfigurationSource.
    • Source

      public Source(File file)
      Constructs a new Source with the specified file. file.
      Parameters:
      file - the file where the input stream originated
    • Source

      public Source(Path path)
      Constructs a new Source from the specified Path.
      Parameters:
      path - the Path where the input stream originated
    • Source

      public Source(URI uri)
      Constructs a new Source from the specified URI.
      Parameters:
      uri - the URI where the input stream originated
    • Source

      @Deprecated public Source(URI uri, long lastModified)
      Deprecated.
      Constructs a new Source from the specified URI.
      Parameters:
      uri - the URI where the input stream originated
      lastModified - Not used.
    • Source

      public Source(URL url)
      Constructs a new Source from the specified URL.
      Parameters:
      url - the URL where the input stream originated
      Throws:
      IllegalArgumentException - if this URL is not formatted strictly according to RFC2396 and cannot be converted to a URI.
  • Method Details

    • normalize

      private static String normalize(File file)
    • toFile

      private static File toFile(Path path)
    • toFile

      private static File toFile(URI uri)
    • toURI

      private static URI toURI(URL url)
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getFile

      public File getFile()
      Gets the file configuration source, or null if this configuration source is based on an URL or has neither a file nor an URL.
      Returns:
      the configuration source file, or null
    • getLocation

      public String getLocation()
      Gets a string describing the configuration source file or URI, or null if this configuration source has neither a file nor an URI.
      Returns:
      a string describing the configuration source file or URI, or null
    • getPath

      public Path getPath()
      Gets this source as a Path.
      Returns:
      this source as a Path.
    • getURI

      public URI getURI()
      Gets the configuration source URI, or null if this configuration source is based on a file or has neither a file nor an URI.
      Returns:
      the configuration source URI, or null
    • getURL

      public URL getURL()
      Gets the configuration source URL.
      Returns:
      the configuration source URI, or null
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object