Debug & Event Logging
Choose where JG Used Vehicles sends debug, audit and security logs
JG Used Vehicles separates debug output, normal audit events and security warnings. Configure the routes in two files:
config/config.luacontrols whether each route is enabled and where it is sent.config/config.webhooks.luacontains Discord webhook URLs and appearance settings.
Logging categories
| Route | Used for |
|---|---|
LOG | Server debug logs used while diagnosing an issue or when JG Scripts support asks you to enable them |
EVENT | Normal audit logs, such as dealership creation, stock acquisition, listing publication and high-value vehicle sales |
SECURITY | Suspicious requests and rate-limit warnings |
Each route can be enabled and sent to different destinations independently.
Configure destinations
Set the destinations in config/config.lua:
Config.Logs = {
LOG = {
enabled = true,
destinations = { "console" }
},
EVENT = {
enabled = true,
destinations = { "ox_lib" }
},
SECURITY = {
enabled = true,
destinations = { "console", "ox_lib" }
}
}Supported destinations are:
| Destination | Description |
|---|---|
console | Prints to the server console |
ox_lib | Sends to lib.logger, which uses the logging service configured for ox_lib |
discord | Sends to the matching Discord webhook URL in config/config.webhooks.lua |
You can send one route to more than one destination. This sends normal events to both ox_lib and Discord:
Config.Logs = {
LOG = {
enabled = true,
destinations = { "console" }
},
EVENT = {
enabled = true,
destinations = { "ox_lib", "discord" }
},
SECURITY = {
enabled = true,
destinations = { "console", "ox_lib" }
}
}Set enabled = false to disable a route:
Config.Logs = {
LOG = {
enabled = false,
destinations = { "console" }
},
EVENT = {
enabled = true,
destinations = { "ox_lib" }
},
SECURITY = {
enabled = true,
destinations = { "console", "ox_lib" }
}
}Config.Debug is separate from server logging. It controls client-side debug output and visual target or zone debugging. The Config.Logs.LOG route controls server debug logs.
Configure Discord webhooks
Discord webhook URLs are stored in config/config.webhooks.lua. This file is loaded on the server only.
Webhooks = {}
Webhooks.BusinessCreation = ""
Webhooks.Acquisition = ""
Webhooks.Listing = ""
Webhooks.HighValueSale = ""
Webhooks.SuspiciousAction = ""
Webhooks.Debug = ""
Webhooks.HighValueSaleMinimum = 500000
Webhooks.DiscordSettings = {
username = "JG Used Vehicles Webhook",
avatarUrl = "https://forum.cfx.re/user_avatar/forum.cfx.re/jgscripts/288/3621910_2.png",
webhooks = Webhooks,
colors = {
success = 0x2ecc71,
danger = 0xe74c3c,
warning = 0xf1c40f,
debug = 0x3498db,
default = 0xff6700
}
}Discord logs are sent only when the route includes the discord destination and the matching webhook URL is set. A blank URL skips that Discord log without stopping the other destinations.
| Webhook | Route | Used for |
|---|---|---|
Webhooks.BusinessCreation | EVENT | Used dealership creation |
Webhooks.Acquisition | EVENT | Vehicles acquired into used stock |
Webhooks.Listing | EVENT | Private and dealership listings |
Webhooks.HighValueSale | EVENT | Completed sales at or above Webhooks.HighValueSaleMinimum |
Webhooks.SuspiciousAction | SECURITY | Suspicious requests and rate-limit warnings |
Webhooks.Debug | LOG | Debug output when the LOG route includes discord |
Webhooks.HighValueSaleMinimum is the minimum sale value in your base currency for a HighValueSale log. It does not change vehicle prices, fees or payouts.
Migrate existing Discord webhooks
Back up the old webhook file
Before updating the resource, keep a copy of your existing server/sv-webhooks.lua file. It contains the webhook URLs and high-value sale threshold you need to move.
Replace the old webhook file
Copy the updated resource files into place, including the new server/sv-webhooks.lua. Don't restore the whole contents of your old file afterwards. An old copy can overwrite the new webhook configuration with blank URLs.
The new file keeps the old Webhooks.Server.Send and Webhooks.Server.SendBusinessAudit functions available for existing server customisations. It forwards those calls to the central logger. Store all webhook URLs in config/config.webhooks.lua from now on.
Move the webhook URLs
Copy each URL into the matching entry in config/config.webhooks.lua:
| Old setting | New setting |
|---|---|
Webhooks.BusinessCreation | Webhooks.BusinessCreation |
Webhooks.Acquisition | Webhooks.Acquisition |
Webhooks.Listing | Webhooks.Listing |
Webhooks.HighValueSale | Webhooks.HighValueSale |
Webhooks.SuspiciousAction | Webhooks.SuspiciousAction |
Webhooks.Debug is new. Leave it blank unless you want LOG entries sent to Discord.
Move the high-value sale threshold
Copy the old threshold into the same setting in config/config.webhooks.lua:
Webhooks.HighValueSaleMinimum = 500000Replace 500000 with the value from your old server/sv-webhooks.lua file.
Enable Discord destinations
Add discord to each route that should send webhook logs. This configuration preserves the old Discord event and security logs while keeping debug logs in the console:
Config.Logs = {
LOG = {
enabled = true,
destinations = { "console" }
},
EVENT = {
enabled = true,
destinations = { "discord" }
},
SECURITY = {
enabled = true,
destinations = { "discord" }
}
}Restart and test
Restart jg-usedvehicles. Trigger one configured event and confirm it reaches the selected destination. For Discord, create a test listing or another event that matches a webhook URL you added.
Customise Discord appearance
Edit Webhooks.DiscordSettings in config/config.webhooks.lua to change the webhook username, avatar and embed colours:
Webhooks.DiscordSettings = {
username = "JG Used Vehicles Webhook",
avatarUrl = "https://forum.cfx.re/user_avatar/forum.cfx.re/jgscripts/288/3621910_2.png",
webhooks = Webhooks,
colors = {
success = 0x2ecc71,
danger = 0xe74c3c,
warning = 0xf1c40f,
debug = 0x3498db,
default = 0xff6700
}
}Last updated 29 August 2026