[ColdBox 4.3.0] Logbox No appenders

22 views
Skip to first unread message

echo

unread,
Jan 9, 2018, 11:21:03 PM1/9/18
to ColdBox Platform
Hi, 
I am trying the features in LogBox. I create a database for logbox to write logs to.
In the config: Coldbox.cfc, I have the following setting:
 logBox = {
// Define Appenders
appenders = {
dbLog = {
class="coldbox.system.logging.appenders.DBAppender",
            properties = 
            {
                dsn = 'test',
                table = 'logs',
                autocreate = true
          },
            levelMax = "INFO",
            levelMin = "FATAL"
}
},
root = {levelMax="INFO", appenders="*"},
    categories = {
        "dblogger" = { levelMin="FATAL", levelMax= "INFO", appenders="dbLog" }
    },
    OFF = ["coldbox.system"]
};
And then I create an API as followed:
any function index( event, rc, prc ){
log.info("hi there");
writedump("#log.hasAppenders() #");
abort;
prc.response.setData( "Welcome to my ColdBox RESTFul Service" );
I check the database, the logs table is created successfully and the "hi there" info log is created as well.
However, the  #log.hasAppenders() # shows false result. Also when I dump the appenders struct, it shows nothing.
I wonder if there is anything wrong I did about the setting of LogBox. appreciate any help. Thanks a lot!
 

br...@bradwood.com

unread,
Jan 9, 2018, 11:55:07 PM1/9/18
to col...@googlegroups.com
That's because your logger technically doesn't have any appenders-- but it inherits from the root logger, which does!  Run this:
 
log.getRootLogger().hasAppenders()
 
If you're just using the "log" variable that is made automatically available in your handlers, then you're not actually using the "dblogger" category that you created.  ColdBox will have created a named/category logger called "handlers.yourHandlerName" and all loggers inherit from the root logger, and your root logger has "*" for appenders so that means the root logger is using the "dbLog" appender.

Thanks!

~Brad

ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp

E-mail: br...@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com 
 
 
--------- Original Message ---------
--
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org
For Bug Reports, visit https://ortussolutions.atlassian.net/browse/COLDBOX
---
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to coldbox+u...@googlegroups.com.
To post to this group, send email to col...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/coldbox/82c81d99-574d-4a46-bab6-c5dc426fce92%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages