Home›Java›Mods›Console logs to MySQL database
Console logs to MySQL database
ModsJava

Console logs to MySQL database

Java mod listed for Minecraft 1.21. Downloads from the MC Java Mods app on Android.

⬇ Download on Spigot
I'll keep this brief.

IMPORTANT NOTE: Made for Paper 1.21.4, only tested on 1.21.4.

Context (skip if you want)
I tried to find a plugin out there that would log all of my Console logs, or rather, specific types (I.E. debug, error etc) to a database which I could report on via a website, as I am not always watching the console. I could not find a plugin that did this. So I made one.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
What does this plugin do?
Note:
  1. No in game permissions
  2. No in game commands
  3. Plugin controlled entirely from the config.yml generated
  4. Plugin starts DEFAULTED to DISABLED; turn it on in the config, configure your MySQL database, then reboot
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
The Configuration is easy right? Yes!

Here is the config, and further below I will explain what they mean. 2 spoilers.
Spoiler: Full Config Code
Code (Text):
enabled: true # MUST be set to true before the plugin activates

mysql:
  host:
  port: 3306
  database:
  user:
  password:
  params:
  pool:
    minimumIdle: 2
    maximumPoolSize: 8
    connectionTimeoutMs: 10000

identify:
  server_name: RANDOMNAME
  server_uuid: b45aee08-c73e-43b8-bdf1-2f7d0487bb95 # auto-generate and save if blank
  hostname: 23ad6bd8-4b1a-4c78-a168-95efa460c428 # auto-detect and save if blank
  build_info: 'Paper 1.21.4-232-12d8fe0 (MC: 1.21.4)' # auto-detect Paper build if blank

capture:
  fatal: true
  errors: true
  warns: true
  info: true
  debug: true
  trace: false
  includeStacktraces: true
  includeMDC: true
  includeThreadName: true
  maxMessageLength: 65535
  maxStackLength: 1000000

batching:
  maxBatchSize: 200
  flushIntervalMs: 1500
  queueCapacity: 10000
  dropPolicy: oldest # oldest | newest | block (block not used to avoid stalling logging threads)

retention:
  enabled: false
  days: 90
  dailyRunHourUtc: 4
 
Spoiler: Full Config Code Explained
enabled – Must be set to true for the plugin to start.
mysql – MySQL database connection details.
  • host / port – Database address and port.
  • database – Name of the database to store logs.
  • user / password – Database login credentials.
  • params – Extra JDBC connection options.
  • pool – Connection pool settings for performance tuning.
identify – Server identity info stored in logs.
  • server_name – Friendly name for the server (any text).
  • server_uuid – Unique ID for the server (auto-generated if blank).
  • hostname – Hostname of the server (auto-detected if blank).
  • build_info – Paper build/version info (auto-detected if blank).
capture – Which log levels and extra info to record.
  • fatal, errors, warns, info, debug, trace – Enable/disable capturing of each log level.
  • includeStacktraces – Store stack traces with errors.
  • includeMDC – Store mapped diagnostic context (extra debug info).
  • includeThreadName – Store the name of the thread that logged the message.
  • maxMessageLength – Maximum length for stored log messages.
  • maxStackLength – Maximum length for stored stack traces.
batching – How logs are queued and sent to the database.
  • maxBatchSize – Maximum logs sent in one database write.
  • flushIntervalMs – How often (in ms) to flush logs to the database.
  • queueCapacity – Maximum logs held in memory before dropping.
  • dropPolicy – What to do if the queue is full (oldest, newest, or block).
retention – Automatic deletion of old logs.
  • enabled – Turn automatic cleanup on/off.
  • days – How many days of logs to keep.
  • dailyRunHourUtc – Hour of day (UTC) when cleanup runs.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Plugin details

Read from the plugin's own plugin.yml.

Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

Console logs to MySQL database is a free Minecraft Java mod. Compatible with Minecraft 1.21. Downloaded 20 times (via Spigot). Download it and open it directly in the game.

Explore more