ColdBox 6.6.1+2 - Given the logBox module configur...
# box-products
b
ColdBox 6.6.1+2 - Given the logBox module configuration below, shouldn't category inheritance cause all INFO logs with "category" values starting with "`coldbox.system`" to be handled by the "coldBoxInfoLogger" appender ONLY? For example, these categories... • coldbox.system.web.services.LoaderService • coldbox.system.web.services.ModuleService • coldbox.system.web.services.RoutingService They ARE going there but they are also going to the root logger and being processed by all the other appenders as well
Copy code
logBox = {
	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" ]
};
w
Copy code
info       : [ "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
Copy code
/**
     * 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.
👍 1
b
Thanks, Wil. That was a big help. the info level was the problem (which was there by default)