Skip to content

Latest commit

History

24 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

java-logger

Simple Java application that uses jfortune and cowsay to output logs.

Table of Contents

Background

In order to test an EFK (Elasticsearch, FluentD and Kibana) stack I required a Java app that can output logs in an easily configurable way so that it is easy to trial various FluentD configuration files. This project outputs a JAR that can be run wherever JAVA is available.

Pre-requisites

All these instructions are for macOS only.

brew install git maven

Build the JAR

mvn clean install

Run the JAR via default entry point

export LOGGER_FILE_PATH=./output.log
export LOGGER_LOOP_COUNT=30
export LOGGER_THREAD_SLEEP=500
java -Dlogger.filePath${LOGGER_FILE_PATH} \
-Dlogger.loopCount=${LOGGER_LOOP_COUNT} \
-Dlogger.sleep=${LOGGER_THREAD_SLEEP} \
-jar target/java-logger-1.0.5-jar-with-dependencies.jar

Here are the available options:

CommandDescription
logger.filePathThe file location of the log into which the output will be written
logger.loopCount(Optional) The number of times to iterate. Default value = 10
logger.sleep(Optional) The number of milliseconds to sleep between each iteration of the loop. Default value = 500

Run the JAR via named entry point

export LOGGER_ENTRY_POINT=30
export LOGGER_FILE_PATH=/var/log/java-logger/output.log
java -Dlogger.filePath${LOGGER_FILE_PATH} -cp target/java-logger-1.0.5-jar-with-dependencies.jar io.thinkstack.logger.slf4j.${LOGGER_ENTRY_POINT}

Here are the available entry points:

Entry PointDescription
HelloWorldOutputs a single Hello World at INFO level plus a message at DEBUG level if enabled
CowsayOutputOutputs a loop of single line INFO messages and then a fortune cookie message delivered via Cowsay
SingleLineOutputOutputs a configurable loop of messages generated via fortune cookies

References

About

Simple Java application that uses jfortune and cowsay to output logs

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages