bhartsfield
05/04/2022, 5:52 PMlogBox = {
appenders : {
coldboxTracer : {
class : "coldbox.system.logging.appenders.ConsoleAppender"
},
dbLogger : {
class : "DBAppender",
properties : {
...
}
},
fileLogger = {
class="RollingFileAppender",
properties = {
...
},
},
coldBoxInfoLogger = {
class="RollingFileAppender",
properties = {
...
},
},
},
root : {
levelMin: "FATAL",
levelMax : "INFO",
appenders : "coldboxTracer,dbLogger,fileLogger"
},
categories : {
"coldbox.system" : {
appenders: "coldBoxInfoLogger",
levelMin: "INFO",
levelMax: "INFO"
}
},
info : [ "coldbox.system" ]
};
wil-shiftinsert
05/05/2022, 7:47 AMinfo : [ "coldbox.system" ]
I think the problem is in these ‘level’ categories. I think you don’t need them if you already have a coldbox.system category. The info..debug categories can be quite handy, but they are quite limited. Implicitly your info level category creates a coldbox.system category which is already there. Effectively overwriting the previous config. The level categories are limited because you can’t specify a levelMin (no big deal most of the time). More annoying is that you can’t specify an appender, defaulting to ALL appenders. So if you already have specified your setup (in categories) don’t use info in this last line.
I think this part of the docs
https://logbox.ortusbooks.com/configuration/configuring-logbox/adding-categories-to-specific-loggin-levels
is confusing at least. Or incomplete. If you look at this function
/**
* Add categories to the INFO level. Send each category as an argument.
*/
LogBoxConfig function info(){
for( var key in arguments ){
category( name=arguments[ key ], levelMax=<http://this.logLevels.INFO|this.logLevels.INFO> );
}
return this;
}
in the LogboxConfig object you see what’s happening. It is adding a category without appenders, and without a levelMin. And it is overriding a category with the same name, which becomes more clear if you follow all code flow. I figured this all out when I decided to write some blogposts about Logbox
https://shiftinsert.nl/logbox-basic-concepts-and-configuration/
Logbox can be quite simple to configure, but if you want to send different messages to different appenders (and especially exclude some messages from an appender ) these logging level categories should be avoided. If you know what you are doing the granular categories
https://logbox.ortusbooks.com/configuration/configuring-logbox/adding-categories-to-specific-loggin-levels
do everything you need.
If you ever try to use NAMED loggers ( not named after components, but just labeled mylogger or AuthenticationLogger etc) the manual is also quite unclear.bhartsfield
05/05/2022, 2:16 PM