Hi,
Trying to track errors on a server and store them in a DB. For some reason though lua_error_url only saves errors when using "lua_run". It won't post any errors in any files. Any idea why this is? gm_luaerror also somewaht works but stack trace doesn't work and neither does the error string itself when an error is clientside.
Thanks
snip -nvm-
lua_error_url reports every error.
When you set the ConVar Serveride, server-side errors are reported.
If it is set to the clients, which is, because the value of the ConVar is internally networked, all errors that occur on the client will be sent to the lua_error_url as long as the ConVar is still set to your url. It also saves error from other servers.
If you're using [URL="https://github.com/danielga/gm_luaerror/releases/download/downloadables/gmsv_luaerror_win32.dll"]gm_luaerror[/URL], it's as simple as this:
[code]
if SERVER then
require 'luaerror'
luaerror.EnableRuntimeDetour( true )
luaerror.EnableCompiletimeDetour( true )
luaerror.EnableClientDetour( true )
local os
if system.IsWindows() then
os = "Windows"
elseif system.IsOSX() then
os = "Mac OSX"
elseif system.IsLinux() then
os = "Linux"
else
os = "Other?"
end
hook.Add( 'LuaError', 'KappaJ.Debug.LuaError.Server.Tracking', function( _RunTime, _FullError, _SourceFile, _SourceLine, _ErrorStack, _Stack )
BroadcastMsg( Color( 255, 255, 255 ), "The server encountered an error @ ", Color( 255, 0, 0 ), _SourceFile, Color( 255, 255, 255 ), " on line ", Color( 255, 0, 0 ), tostring( _SourceLine ), Color( 255, 255, 255 ), " with: ", Color( 255, 0, 0 ), _ErrorStack, Color( 255, 255, 255 ), " ● Tell KappaJ his coding sux")
_GM.MYSQL:Query( "INSERT INTO _errors (user, hash, full_error, error, realm, addon, gamemode, os, line_number, file, time_stamp) VALUES ('CONSOLE', '', '" .. _GM.MYSQL:Escape( _FullError ) .. "', '" .. _GM.MYSQL:Escape( _ErrorStack ) .. "', 'SERVER', '', '" .. _GM.MYSQL:Escape( GetConVar("gamemode"):GetString() ) .. "', '" .. _GM.MYSQL:Escape( os ) .. "', '" .. _SourceLine .. "', '" .. _GM.MYSQL:Escape( _SourceFile ) .. "', CURRENT_TIMESTAMP)" )
end)
hook.Add( 'ClientLuaError', 'KappaJ.Debug.LuaError.Client.Tracking', function( _Player, _FullError, _SourceFile, _SourceLine, _ErrorStack, _Stack )
_GM.MYSQL:Query( "INSERT INTO _errors (hash, full_error, error, realm, addon, gamemode, os, line_number, file, user, time_stamp) VALUES ('', '" .. _GM.MYSQL:Escape( _FullError ) .. "', '" .. _GM.MYSQL:Escape( _ErrorStack ) .. "', 'CLIENT', '', '" .. _GM.MYSQL:Escape( GetConVar("gamemode"):GetString() ) .. "', '" .. _GM.MYSQL:Escape( os ) .. "', '" .. _SourceLine .. "', '" .. _GM.MYSQL:Escape( _SourceFile ) .. "', '" .. _GM.MYSQL:Escape( _Player:SteamID() ) .. "', CURRENT_TIMESTAMP)" )
end)
end
[/code]
[t]https://i.gyazo.com/0f5f1b92f28e29332eaf00bd95de5682.png[/t]
Stack trace also imports fine it seems:
[t]https://i.gyazo.com/3afb616cdd9dde2ad4fd3b91ae4689f2.png[/t]
[QUOTE=kpjVideo;51969126]If you're using [URL="https://github.com/danielga/gm_luaerror/releases/download/downloadables/gmsv_luaerror_win32.dll"]gm_luaerror[/URL], it's as simple as this:
[code]
if SERVER then
require 'luaerror'
luaerror.EnableRuntimeDetour( true )
luaerror.EnableCompiletimeDetour( true )
luaerror.EnableClientDetour( true )
local os
if system.IsWindows() then
os = "Windows"
elseif system.IsOSX() then
os = "Mac OSX"
elseif system.IsLinux() then
os = "Linux"
else
os = "Other?"
end
hook.Add( 'LuaError', 'KappaJ.Debug.LuaError.Server.Tracking', function( _RunTime, _FullError, _SourceFile, _SourceLine, _ErrorStack, _Stack )
BroadcastMsg( Color( 255, 255, 255 ), "The server encountered an error @ ", Color( 255, 0, 0 ), _SourceFile, Color( 255, 255, 255 ), " on line ", Color( 255, 0, 0 ), tostring( _SourceLine ), Color( 255, 255, 255 ), " with: ", Color( 255, 0, 0 ), _ErrorStack, Color( 255, 255, 255 ), " ● Tell KappaJ his coding sux")
_GM.MYSQL:Query( "INSERT INTO _errors (user, hash, full_error, error, realm, addon, gamemode, os, line_number, file, time_stamp) VALUES ('CONSOLE', '', '" .. _GM.MYSQL:Escape( _FullError ) .. "', '" .. _GM.MYSQL:Escape( _ErrorStack ) .. "', 'SERVER', '', '" .. _GM.MYSQL:Escape( GetConVar("gamemode"):GetString() ) .. "', '" .. _GM.MYSQL:Escape( os ) .. "', '" .. _SourceLine .. "', '" .. _GM.MYSQL:Escape( _SourceFile ) .. "', CURRENT_TIMESTAMP)" )
end)
hook.Add( 'ClientLuaError', 'KappaJ.Debug.LuaError.Client.Tracking', function( _Player, _FullError, _SourceFile, _SourceLine, _ErrorStack, _Stack )
_GM.MYSQL:Query( "INSERT INTO _errors (hash, full_error, error, realm, addon, gamemode, os, line_number, file, user, time_stamp) VALUES ('', '" .. _GM.MYSQL:Escape( _FullError ) .. "', '" .. _GM.MYSQL:Escape( _ErrorStack ) .. "', 'CLIENT', '', '" .. _GM.MYSQL:Escape( GetConVar("gamemode"):GetString() ) .. "', '" .. _GM.MYSQL:Escape( os ) .. "', '" .. _SourceLine .. "', '" .. _GM.MYSQL:Escape( _SourceFile ) .. "', '" .. _GM.MYSQL:Escape( _Player:SteamID() ) .. "', CURRENT_TIMESTAMP)" )
end)
end
[/code]
[t]https://i.gyazo.com/0f5f1b92f28e29332eaf00bd95de5682.png[/t]
Stack trace also imports fine it seems:
[t]https://i.gyazo.com/3afb616cdd9dde2ad4fd3b91ae4689f2.png[/t][/QUOTE]
With some editing to my likings and getting it to work with mysqloo v9 with the api I use for my server, works fine. Thanks! I'm not sure why my previous code didn't work, I even had Freddy (Maker of MySqloov9 look at mine and couldn't figure out why)
Sorry, you need to Log In to post a reply to this thread.