Skip to content

Hodes/log4j2example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

log4j2example

An example of Log4j2 java application that does custom loggings with JDBC appender.

It has Docker Compose to start the testing MySQL database.

Configure database

  • (Optional) Start mysql database using the given docker-compose.yml docker compose up -d
  • Connect to the database and initialize log table

CREATE TABLE `logs` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `log_at` datetime NOT NULL,
  `logger` varchar(100) NOT NULL,
  `loglevel` varchar(100) NOT NULL,
  `message` varchar(1000) NOT NULL,
  `exception` text,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=64 DEFAULT CHARSET=latin1;

  • (Optional) Change the database info at src/main/java/log4jexample/ConnectionFactory

Run App

./gradlew run

About

A simple project to test the logging configuration with Log4J to register custom logs on mysql database. Project was configured with gradle.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages