Skip to content

fuinorg/ext4logback

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ext4logback

Extensions for Logback

Java Maven Build Maven Central Javadocs LGPLv3 License Java Development Kit 11

Versions

  • 0.3.x (or later) = Java 11
  • 0.2.0 = Java 8

Features

Configuring Logback for a standalone application is easy:

new LogbackStandalone().init(new File("path/to/your/logback.xml"), 
      new NewLogConfigFileParams("your.app.package", "myapp"));

For more options, see JavaDoc.

Here is an example of a main method:

/**
 * Starts the application.
 * 
 * @param args
 *            Only optional argument is the 'logback.xml' file path and
 *            name. If no argument is provided it's assumed that the file name 
 *            is 'logback.xml' and it's in the current directory.
 */
public static void main(final String[] args) {
    try {
        // Initializes Logback by reading the XML config file.
        // If the file does not exist, it will be created with some defaults.
        // This is a convenience method that directly uses the main method's arguments.
        new LogbackStandalone().init(args, 
               new NewLogConfigFileParams("your.app.package", "myapp"));
        LOG.info("Application running...");
        // Your code goes here...
        System.exit(0);
    } catch (RuntimeException ex) {
        ex.printStackTrace(System.err);
        System.exit(1);
    }
}

Example usage

There is a simple example project available here: Example Project

Snapshots

Snapshots can be found on the OSS Sonatype Snapshots Repository.

Add the following to your .m2/settings.xml to enable snapshots in your Maven build:

<pluginRepository>
    <id>sonatype.oss.snapshots</id>
    <name>Sonatype OSS Snapshot Repository</name>
    <url>http://oss.sonatype.org/content/repositories/snapshots</url>
    <releases>
        <enabled>false</enabled>
    </releases>
    <snapshots>
        <enabled>true</enabled>
    </snapshots>
</pluginRepository>

About

Extensions for Logback

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages