RE: [coldbox:11775] Replicating bugtracers behavior with logbox

You “email” category probably isn’t being used at all. If you log things manually with LogBox().getLogger(“myLoggerCategoryName”).error(“AHH!”) or whatever, it will look for a category (AKA “named logger”) named “myLoggerCategoryName” and use it. If one doesn’t exist, then it defaults up to the root logger. Errors caught by the framework are logged with the a category name of the app name I believe by default, which probably means that the root logger is servicing them.

Try taking out your “email” category and see if you are still get all the E-mails. If so, they are coming from root. Also, I don’t think errors that ColdBox catches are “fatal”, I believe they are just “error”. Logging only “fatal” will probably get you nothing. I don’t know the difference between error and fatal, but I haven’t wondered that before. Perhaps Luis can tell us since he came up with the logger levels. :slight_smile: (Actually, I think he copied them from Log4J)

If you don’t want any other appenders (such as a log file appender for debug and warning stuff), then you should be able to set a levelMax for the root category of “1” or “ERROR” so it ignores debug, info, and warning. I would recommend putting the levelMax on the appender though, so you could still have debug/info/warning logs sent to a text file for instance. Both categories and appenders can have max and min log levels, and the stricter of the two is used.

Also, an alternative to turning off ALL messages that aren’t errors, is to create a category named “coldbox.system” and turn it off. Since logging categories inherit like package names, any logs sent from within the core ColdBox code (i.e. coldbox.system.ioc) would be ignored. That way you can start adding debugging logs to your app and ignore all the ColdBox chatter.

~Brad

You may want to consider plug Hoth…

http://aarongreenlee.com/Hoth

Aaron Greenlee
http://aarongreenlee.com/

Here is the correct link:

http://aarongreenlee.com/hoth

Hi Brad,

Thanks! That helps a lot. I updated the configuration according to
your advice and it appears to work correctly now:

    //LogBox DSL
    logBox = {
      // Define Appenders
      appenders = {
        email = {
          class="coldbox.system.logging.appenders.EmailAppender",
          levelMin="FATAL",
          levelMax="ERROR",
          properties = {
            subject = "",
            from = "myemail",
            to = "myemail"
          }
        }
      },
      // Root Logger
      root = { levelMin = "FATAL", levelMax = "INFO", appenders="*" },
      "coldbox.system" = { levelMin = "OFF", levelMax = "OFF" }
    };

You are right in that FATAL does not give me any of the exceptions I
was expecting from coldbox, only ERROR does. FATAL are probably
reserved for errors only in ColdBox.

Now I just have to see if Icould get the exception information into
the custom layout and I will be able to replicate the bugtracers
functionality from before...

That looks interesting, I'll give it a look, thanks.