No Description

Matt Clark 913ccf4403 Release 1.5.1 2 weeks ago
src 913ccf4403 Release 1.5.1 2 weeks ago
.env 913ccf4403 Release 1.5.1 2 weeks ago
.gitignore 2f4d40d1f5 Initial commit pf LibAPIs. 2 years ago
README.md 913ccf4403 Release 1.5.1 2 weeks ago
pom.xml 913ccf4403 Release 1.5.1 2 weeks ago

README.md

LibLog

A basic application logger.

  • Multiple log files
  • Roll log files daily
  • String localization
  • And more...

Maven Dependency

Include the library in your project by adding the following dependency to your pom.xml

<dependency>
    <groupId>com.mclarkdev.tools</groupId>
    <artifactId>liblog</artifactId>
    <version>1.5.1</version>
</dependency>

Configuration

Default configuraion values can be modified by setting environment variables prior to launching the application.

LOG_DIR    Set the path where log files will be created.    (logs)
LOG_NAME   Set the base name of the default log file.       (server)
LOG_DEBUG  Set any value to enable debug logging.

Example

Invoke any of the LibLog methods anywhere your application should produce a log message.

LibLog._log("This is a log message.");
LibLog._logF("Hello, %s", "world");

Using Localized Strings

Load localized strings based on the users default language.

String lang = LibArgs.instance().getString(//
        "language", Locale.getDefault().toString());

// Load localized message codes
LibLog._logF("Loading Language Pack: %s", lang);
LibLog.loadStrings(ServerLauncher.class.getResourceAsStream(//
        String.format("/strings/codes.%s.properties", lang)));

Use logc methods to resolve logger codes to localized messages.

LibLog._clog("I0001");

License

Open source & free for all. ❤