Skip to content

Simple Java application that uses jfortune and cowsay to output logs

Notifications You must be signed in to change notification settings

deploymentking/java-logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

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:

Command Description
logger.filePath The 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 Point Description
HelloWorld Outputs a single Hello World at INFO level plus a message at DEBUG level if enabled
CowsayOutput Outputs a loop of single line INFO messages and then a fortune cookie message delivered via Cowsay
SingleLineOutput Outputs 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

Watchers

Forks

Packages

No packages published

Languages