Skip to content

cmosher01/log-files

Repository files navigation

log-files

Copyright © 2019, Christopher Alan Mosher, Shelton, Connecticut, USA, cmosher01@gmail.com.

Donate License

Java library to get a cross-platform log file.

usage

repositories {
    mavenCentral()
    maven {
        url = uri('https://public:\u0067hp_fya6Kseu3XOBMg2icbg7f1LP6ZFYjj35v4Zj@maven.pkg.github.com/cmosher01/*')
    }
}

dependencies {
    implementation group: 'nu.mine.mosher.io', name: 'log-files', version: 'latest.release'
}
package com.example.foobar;
import nu.mine.mosher.io.LogFiles;

public class FooBar {
    public static void main(String[] args) {
        File logFile = LogFiles.getLogFileOf(FooBar.class);
        // ...
    }
}

example with slf4j-simple

dependencies {
    implementation group: 'nu.mine.mosher.io', name: 'log-files', version: 'latest.release'
    implementation group: 'org.slf4j', name: 'slf4j-api', version: 'latest.integration'
    runtimeOnly group: 'org.slf4j', name: 'slf4j-simple', version: 'latest.integration'
}
package com.example.foobar;
import nu.mine.mosher.io.LogFiles;

public class FooBar {
    public static void main(String[] args) {
        File logFile = LogFiles.getLogFileOf(FooBar.class);
        System.out.println(logFile.getPath());

        System.setProperty("org.slf4j.simpleLogger.logFile", logFile.getPath());
        Logger log = LoggerFactory.getLogger(FooBar.class);
        log.info("Test logging message to log file.");
    }
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages