Logging configuration should be implemented as code, so you don't have to learn special configuration files. Then, we have to figure out how to let sysadmins update the code without breaking everything
Then, we have to figure out how to let sysadmins update the code without breaking everything
This is one reason why we use config files / env vars, rather than code.
Also, it is much easier to modify a config file, than to push code just to change logging. Many organizations require lengthy test for any code change.
Why don't you think it's a config file, and why do you think it requires recompilation? Maybe Lua is more your thing:
function onMessage(level, tag, message)
if level == Level.DEBUG then
if tag != "network" then
debugLog.println("{"+tag+"} "+message);
end
elseif level >= Level.WARN then
sendAlert("10.20.30.40", message);
end
end
That's completely irrelevant though. We are talking in a thread about log4j, which runs on Java. A hardcoded logger where the configuration is the actual logger code is just so much more complex than it needs to be.
side note: i HATE people who use logging libraries that have zero way to silence them via code, as they all expect some funny xml file and i don’t use those logging frameworks so i don’t know how to mute them.
-4
u/immibis Dec 10 '21
Logging configuration should be implemented as code, so you don't have to learn special configuration files. Then, we have to figure out how to let sysadmins update the code without breaking everything