Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Configuring LogBox

LogBox comes pre-configured for operation with very basic logging. However, you can customize it to your fancy using different configuration strategies using the programmatic configuration object or the LogBox Config DSL.

When you are in a ColdBox application, you will have a logbox structure in your ColdBox.bx (or .cfc for CFML) already that you can use, or you can create a portable class as well and place it in config/LogBox.bx (or .cfc for CFML)

Configuration can be done in the following ways:

  1. No configuration: Uses the default configuration shown below

  2. Portable Class: Creating a portable data class using the LogBox DSL in a configure() method

  3. LogBoxConfig: Creating the LogBoxConfig object and interacting with its methods programmatically

  4. LogBox DSL Struct: Passing a struct literal into LogBox, using the LogBox DSL.

LogBox DSL

1. Default Configuration

This is the default configuration when LogBox is created with no config:

class {

  /**
   *  Configure logBox
   */
  function configure(){
    logBox = {
	// Define Appenders
	appenders : { 
		console : { class : "ConsoleAppender" } 
	},
	
	// Root Logger
	root : { 
		levelmax : "INFO", 
		appenders : "*" 
	}
    };
  }

}

// Instantiate it
application.logbox = new logbox.system.logging.LogBox();

2. Portable Class

You can create a class with a single configure method with the LogBox configuration in a variable called logbox using the LogBox DSL.

3. Programmatic LogBoxConfig

4. Struct Literal Config

Last updated

Was this helpful?