[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"blog-post-using-logbox-for-logging-in-fw1":3},{"id":4,"title":5,"body":6,"date":1183,"description":1184,"extension":265,"meta":1185,"navigation":1032,"path":1186,"published":1032,"seo":1187,"slug":1188,"stem":1189,"summary":5,"tags":1190,"__hash__":1193},"blog/blog/2017-09-16-using-logbox-for-logging-in-fw1.md","Using LogBox For Logging In FW/1",{"type":7,"value":8,"toc":1175},"minimark",[9,21,26,37,52,55,60,64,69,78,82,90,120,123,232,243,248,252,258,261,323,328,335,405,408,412,415,420,456,459,470,716,728,731,740,898,901,911,918,991,998,1001,1086,1103,1107,1110,1113,1121,1130,1144,1148,1151,1160,1168,1171],[10,11,12,13,20],"p",{},"I've seen talk of FW/1 and LogBox integration come up a few times on the ",[14,15,19],"a",{"href":16,"rel":17},"https://cfml-slack.herokuapp.com/",[18],"nofollow","CFML Slack",", so I figured I'd run through a way to get that set up in your application and start using it.",[22,23,25],"h3",{"id":24},"what-is-logbox","What Is LogBox?",[27,28,29],"blockquote",{},[10,30,31,36],{},[14,32,35],{"href":33,"rel":34},"https://www.gitbook.com/book/ortus/logbox-documentation/details",[18],"LogBox"," is a standalone enterprise ColdFusion (CFML) logging library designed to give you flexibility, simplicity, and power when logging or tracing is needed in your applications.",[10,38,39,40,45,46,51],{},"Based on ",[14,41,44],{"href":42,"rel":43},"https://logging.apache.org/log4j/2.x/",[18],"Log4j",", LogBox offers capabilities to log events and data in your application using various ",[14,47,50],{"href":48,"rel":49},"https://logbox.ortusbooks.com/content/appender_properties/",[18],"appenders"," such as writing to a file, database, and email formats.",[10,53,54],{},"We're just going to scratch the surface in this article but let's break this down...",[56,57,59],"h2",{"id":58},"getting-started","Getting Started",[22,61,63],{"id":62},"prerequisites","Prerequisites",[65,66,68],"h4",{"id":67},"commandbox","CommandBox",[10,70,71,72,77],{},"The examples will be making use of CommandBox to build out dependencies so you will want to have that ",[14,73,76],{"href":74,"rel":75},"https://ortus.gitbooks.io/commandbox-documentation/content/setup/installation.html",[18],"installed",".",[65,79,81],{"id":80},"setting-up-dependencies-in-boxjson","Setting Up Dependencies In box.json",[10,83,84,85,89],{},"Start CommandBox from a terminal/command prompt, point it at your project and create a ",[86,87,88],"code",{},"box.json"," for CommandBox to identify with.",[91,92,97],"pre",{"className":93,"code":94,"language":95,"meta":96,"style":96},"language-shell shiki shiki-themes github-light github-dark github-dark monokai","#> box\n#> cd /path/to/fw1-logbox-example\n#> init fw1-logbox-example\n","shell","",[86,98,99,108,114],{"__ignoreMap":96},[100,101,104],"span",{"class":102,"line":103},"line",1,[100,105,107],{"class":106},"sq-8i","#> box\n",[100,109,111],{"class":102,"line":110},2,[100,112,113],{"class":106},"#> cd /path/to/fw1-logbox-example\n",[100,115,117],{"class":102,"line":116},3,[100,118,119],{"class":106},"#> init fw1-logbox-example\n",[10,121,122],{},"Now define your dependencies in box.json. At a minimum, we want to add the settings below.",[91,124,128],{"className":125,"code":126,"language":127,"meta":96,"style":96},"language-json shiki shiki-themes github-light github-dark github-dark monokai","{\n  \"name\": \"fw1-logbox-example\",\n  \"dependencies\": {\n    \"fw1\": \"be\",\n    \"logbox\": \"x\"\n  },\n  \"installPaths\": {\n    \"fw1\": \"framework\",\n    \"logbox\": \"subsystems/logbox/\"\n  }\n}\n","json",[86,129,130,136,152,160,173,184,190,198,210,220,226],{"__ignoreMap":96},[100,131,132],{"class":102,"line":103},[100,133,135],{"class":134},"s__4a","{\n",[100,137,138,142,145,149],{"class":102,"line":110},[100,139,141],{"class":140},"sHysA","  \"name\"",[100,143,144],{"class":134},": ",[100,146,148],{"class":147},"sSnWl","\"fw1-logbox-example\"",[100,150,151],{"class":134},",\n",[100,153,154,157],{"class":102,"line":116},[100,155,156],{"class":140},"  \"dependencies\"",[100,158,159],{"class":134},": {\n",[100,161,163,166,168,171],{"class":102,"line":162},4,[100,164,165],{"class":140},"    \"fw1\"",[100,167,144],{"class":134},[100,169,170],{"class":147},"\"be\"",[100,172,151],{"class":134},[100,174,176,179,181],{"class":102,"line":175},5,[100,177,178],{"class":140},"    \"logbox\"",[100,180,144],{"class":134},[100,182,183],{"class":147},"\"x\"\n",[100,185,187],{"class":102,"line":186},6,[100,188,189],{"class":134},"  },\n",[100,191,193,196],{"class":102,"line":192},7,[100,194,195],{"class":140},"  \"installPaths\"",[100,197,159],{"class":134},[100,199,201,203,205,208],{"class":102,"line":200},8,[100,202,165],{"class":140},[100,204,144],{"class":134},[100,206,207],{"class":147},"\"framework\"",[100,209,151],{"class":134},[100,211,213,215,217],{"class":102,"line":212},9,[100,214,178],{"class":140},[100,216,144],{"class":134},[100,218,219],{"class":147},"\"subsystems/logbox/\"\n",[100,221,223],{"class":102,"line":222},10,[100,224,225],{"class":134},"  }\n",[100,227,229],{"class":102,"line":228},11,[100,230,231],{"class":134},"}\n",[10,233,234,235,238,239,242],{},"This will tell CommandBox that we need the latest develop version of FW/1 and latest stable version of LogBox. We're also specifying that we want FW/1 to go in ",[86,236,237],{},"/framework"," and LogBox to go in ",[86,240,241],{},"/subsystems"," directories.",[27,244,245],{},[10,246,247],{},"Due to the modular nature of subsystems, I personally prefer treating LogBox as a module in this case but, you can put it anywhere you'd like.",[65,249,251],{"id":250},"framework-one-structure","Framework One Structure",[10,253,254,255,77],{},"You'll need an FW/1 application structured out. We can call it ",[86,256,257],{},"fw1-logbox-example",[10,259,260],{},"Here's the minimal requirements for the project:",[91,262,266],{"className":263,"code":264,"language":265,"meta":96,"style":96},"language-md shiki shiki-themes github-light github-dark github-dark monokai","fw1-logbox-example\n|- /conf\n|- /controllers\n|- /layouts\n|- /subsystems\n|- /views\n|-- /main\n|--- default.cfm\n|--- error.cfm\n|- Application.cfc\n|- index.cfm\n","md",[86,267,268,273,278,283,288,293,298,303,308,313,318],{"__ignoreMap":96},[100,269,270],{"class":102,"line":103},[100,271,272],{"class":134},"fw1-logbox-example\n",[100,274,275],{"class":102,"line":110},[100,276,277],{"class":134},"|- /conf\n",[100,279,280],{"class":102,"line":116},[100,281,282],{"class":134},"|- /controllers\n",[100,284,285],{"class":102,"line":162},[100,286,287],{"class":134},"|- /layouts\n",[100,289,290],{"class":102,"line":175},[100,291,292],{"class":134},"|- /subsystems\n",[100,294,295],{"class":102,"line":186},[100,296,297],{"class":134},"|- /views\n",[100,299,300],{"class":102,"line":192},[100,301,302],{"class":134},"|-- /main\n",[100,304,305],{"class":102,"line":200},[100,306,307],{"class":134},"|--- default.cfm\n",[100,309,310],{"class":102,"line":212},[100,311,312],{"class":134},"|--- error.cfm\n",[100,314,315],{"class":102,"line":222},[100,316,317],{"class":134},"|- Application.cfc\n",[100,319,320],{"class":102,"line":228},[100,321,322],{"class":134},"|- index.cfm\n",[27,324,325],{},[10,326,327],{},"Note: /conf is not an FW/1 requirement. We'll use it to house some settings for LogBox.",[10,329,330,331,334],{},"And the base for our FW/1 settings in ",[86,332,333],{},"Application.cfc",":",[91,336,340],{"className":337,"code":338,"language":339,"meta":96,"style":96},"language-js shiki shiki-themes github-light github-dark github-dark monokai","variables.framework = {\n  defaultSection: 'main',\n  defaultItem: 'default',\n  error: 'main.error',\n  diEngine: 'di1',\n  subsystems: {}\n};\n","js",[86,341,342,354,365,375,385,395,400],{"__ignoreMap":96},[100,343,344,347,351],{"class":102,"line":103},[100,345,346],{"class":134},"variables.framework ",[100,348,350],{"class":349},"sOw68","=",[100,352,353],{"class":134}," {\n",[100,355,356,359,363],{"class":102,"line":110},[100,357,358],{"class":134},"  defaultSection: ",[100,360,362],{"class":361},"svw4x","'main'",[100,364,151],{"class":134},[100,366,367,370,373],{"class":102,"line":116},[100,368,369],{"class":134},"  defaultItem: ",[100,371,372],{"class":361},"'default'",[100,374,151],{"class":134},[100,376,377,380,383],{"class":102,"line":162},[100,378,379],{"class":134},"  error: ",[100,381,382],{"class":361},"'main.error'",[100,384,151],{"class":134},[100,386,387,390,393],{"class":102,"line":175},[100,388,389],{"class":134},"  diEngine: ",[100,391,392],{"class":361},"'di1'",[100,394,151],{"class":134},[100,396,397],{"class":102,"line":186},[100,398,399],{"class":134},"  subsystems: {}\n",[100,401,402],{"class":102,"line":192},[100,403,404],{"class":134},"};\n",[10,406,407],{},"We'll add more to the settings shortly.",[65,409,411],{"id":410},"finalizing-the-setup","Finalizing the Setup",[10,413,414],{},"For ease of defining paths to LogBox, we'll create an application mapping.",[10,416,417,418,334],{},"Add this to your ",[86,419,333],{},[91,421,423],{"className":337,"code":422,"language":339,"meta":96,"style":96},"this.mappings = {\n    \"/logbox\" = expandPath(\"./subsystems/logbox\")\n};\n",[86,424,425,438,452],{"__ignoreMap":96},[100,426,427,431,434,436],{"class":102,"line":103},[100,428,430],{"class":429},"s0XdW","this",[100,432,433],{"class":134},".mappings ",[100,435,350],{"class":349},[100,437,353],{"class":134},[100,439,440,443,446,449],{"class":102,"line":110},[100,441,442],{"class":361},"    \"/logbox\"",[100,444,445],{"class":134}," = expandPath(",[100,447,448],{"class":361},"\"./subsystems/logbox\"",[100,450,451],{"class":134},")\n",[100,453,454],{"class":102,"line":116},[100,455,404],{"class":134},[10,457,458],{},"Now we'll tell DI/1 where LogBox and its components are and define some arguments for any constructor methods.",[10,460,461,462,465,466,469],{},"First, we're going to need to create a ",[86,463,464],{},"LogBoxConfig.cfc"," file with our custom settings to pass to LogBox. This will go in the ",[86,467,468],{},"/conf"," directory.",[91,471,473],{"className":337,"code":472,"language":339,"meta":96,"style":96},"component {\n    void function configure() {\n        logBox = {\n            appenders = {\n                // RollingFileAppender outputs to the logs/MYTESTLOG.log file\n                myTestLog = {\n                    class = \"logbox.system.logging.appenders.RollingFileAppender\",\n                    levelMax = \"WARN\",\n                    levelMin = \"FATAL\",\n                    properties = {\n                        filePath = \"/logs\",\n                        autoExpand = true,\n                        fileMaxSize = 3000,\n                        fileMaxArchives = 5\n                    }\n                }\n            },\n            root = { levelmax = \"DEBUG\", levelMin = \"FATAL\", appenders = \"*\" }\n        };\n    }\n}\n",[86,474,475,480,496,505,514,519,528,562,574,586,594,608,622,635,646,652,658,664,699,705,711],{"__ignoreMap":96},[100,476,477],{"class":102,"line":103},[100,478,479],{"class":134},"component {\n",[100,481,482,485,489,493],{"class":102,"line":110},[100,483,484],{"class":349},"    void",[100,486,488],{"class":487},"seVH3"," function",[100,490,492],{"class":491},"s9ihy"," configure",[100,494,495],{"class":134},"() {\n",[100,497,498,501,503],{"class":102,"line":116},[100,499,500],{"class":134},"        logBox ",[100,502,350],{"class":349},[100,504,353],{"class":134},[100,506,507,510,512],{"class":102,"line":162},[100,508,509],{"class":134},"            appenders ",[100,511,350],{"class":349},[100,513,353],{"class":134},[100,515,516],{"class":102,"line":175},[100,517,518],{"class":106},"                // RollingFileAppender outputs to the logs/MYTESTLOG.log file\n",[100,520,521,524,526],{"class":102,"line":186},[100,522,523],{"class":134},"                myTestLog ",[100,525,350],{"class":349},[100,527,353],{"class":134},[100,529,530,533,536,540,542,545,547,550,552,554,556,559],{"class":102,"line":192},[100,531,532],{"class":487},"                    class",[100,534,535],{"class":134}," = \"",[100,537,539],{"class":538},"sqGHR","logbox",[100,541,77],{"class":134},[100,543,544],{"class":538},"system",[100,546,77],{"class":134},[100,548,549],{"class":538},"logging",[100,551,77],{"class":134},[100,553,50],{"class":538},[100,555,77],{"class":134},[100,557,558],{"class":538},"RollingFileAppender",[100,560,561],{"class":134},"\",\n",[100,563,564,567,569,572],{"class":102,"line":200},[100,565,566],{"class":538},"                    levelMax",[100,568,535],{"class":134},[100,570,571],{"class":538},"WARN",[100,573,561],{"class":134},[100,575,576,579,581,584],{"class":102,"line":212},[100,577,578],{"class":538},"                    levelMin",[100,580,535],{"class":134},[100,582,583],{"class":538},"FATAL",[100,585,561],{"class":134},[100,587,588,591],{"class":102,"line":222},[100,589,590],{"class":538},"                    properties",[100,592,593],{"class":134}," = {\n",[100,595,596,600,603,606],{"class":102,"line":228},[100,597,599],{"class":598},"sYoJV","                        filePath",[100,601,602],{"class":349}," =",[100,604,605],{"class":361}," \"/logs\"",[100,607,151],{"class":134},[100,609,611,614,616,620],{"class":102,"line":610},12,[100,612,613],{"class":598},"                        autoExpand",[100,615,602],{"class":349},[100,617,619],{"class":618},"s-7EV"," true",[100,621,151],{"class":134},[100,623,625,628,630,633],{"class":102,"line":624},13,[100,626,627],{"class":598},"                        fileMaxSize",[100,629,602],{"class":349},[100,631,632],{"class":618}," 3000",[100,634,151],{"class":134},[100,636,638,641,643],{"class":102,"line":637},14,[100,639,640],{"class":598},"                        fileMaxArchives",[100,642,602],{"class":349},[100,644,645],{"class":618}," 5\n",[100,647,649],{"class":102,"line":648},15,[100,650,651],{"class":134},"                    }\n",[100,653,655],{"class":102,"line":654},16,[100,656,657],{"class":134},"                }\n",[100,659,661],{"class":102,"line":660},17,[100,662,663],{"class":134},"            },\n",[100,665,667,670,672,675,677,680,683,685,688,691,693,696],{"class":102,"line":666},18,[100,668,669],{"class":134},"            root ",[100,671,350],{"class":349},[100,673,674],{"class":134}," { levelmax ",[100,676,350],{"class":349},[100,678,679],{"class":361}," \"DEBUG\"",[100,681,682],{"class":134},", levelMin ",[100,684,350],{"class":349},[100,686,687],{"class":361}," \"FATAL\"",[100,689,690],{"class":134},", appenders ",[100,692,350],{"class":349},[100,694,695],{"class":361}," \"*\"",[100,697,698],{"class":134}," }\n",[100,700,702],{"class":102,"line":701},19,[100,703,704],{"class":134},"        };\n",[100,706,708],{"class":102,"line":707},20,[100,709,710],{"class":134},"    }\n",[100,712,714],{"class":102,"line":713},21,[100,715,231],{"class":134},[10,717,718,719,721,722,727],{},"Above we set up our configuration file to log to a physical file (MYTESTLOG.log) that uses the ",[86,720,558],{},". Here we can define where the file will go as well. You can read up more on the options in the ",[14,723,726],{"href":724,"rel":725},"https://logbox.ortusbooks.com/content/configuring_logbox/",[18],"Configuring LogBox"," section of the docs.",[10,729,730],{},"Now we will declare the LogBoxConfig.cfc as a bean in DI/1 and pass it to LogBox.",[10,732,733,734,737,738,77],{},"Add this block of code to the empty ",[86,735,736],{},"variables.framework.subsystems"," struct in ",[86,739,333],{},[91,741,743],{"className":337,"code":742,"language":339,"meta":96,"style":96},"logbox: {\n    diLocations: \"/logbox\",\n    diConfig: {\n        loadListener: function(di1) {\n            di1.declare(\"LogBoxConfig\").instanceOf(\"logbox.system.logging.config.LogBoxConfig\")\n               .withOverrides({ CFCConfigPath: \"conf.LogBoxConfig\" })\n               .done()\n               .declare(\"LogBox\").instanceOf(\"logbox.system.logging.LogBox\")\n               .withOverrides({ config: di1.getBean(\"LogBoxConfig\") });\n        }\n    }\n}\n",[86,744,745,752,764,771,791,817,834,844,866,885,890,894],{"__ignoreMap":96},[100,746,747,750],{"class":102,"line":103},[100,748,539],{"class":749},"sO2oV",[100,751,159],{"class":134},[100,753,754,757,759,762],{"class":102,"line":110},[100,755,756],{"class":749},"    diLocations",[100,758,144],{"class":134},[100,760,761],{"class":361},"\"/logbox\"",[100,763,151],{"class":134},[100,765,766,769],{"class":102,"line":116},[100,767,768],{"class":749},"    diConfig",[100,770,159],{"class":134},[100,772,773,776,778,781,784,788],{"class":102,"line":162},[100,774,775],{"class":749},"        loadListener",[100,777,144],{"class":134},[100,779,780],{"class":487},"function",[100,782,783],{"class":134},"(",[100,785,787],{"class":786},"sYQ0Z","di1",[100,789,790],{"class":134},") {\n",[100,792,793,796,799,801,804,807,810,812,815],{"class":102,"line":175},[100,794,795],{"class":134},"            di1.",[100,797,798],{"class":491},"declare",[100,800,783],{"class":134},[100,802,803],{"class":361},"\"LogBoxConfig\"",[100,805,806],{"class":134},").",[100,808,809],{"class":491},"instanceOf",[100,811,783],{"class":134},[100,813,814],{"class":361},"\"logbox.system.logging.config.LogBoxConfig\"",[100,816,451],{"class":134},[100,818,819,822,825,828,831],{"class":102,"line":186},[100,820,821],{"class":134},"               .",[100,823,824],{"class":491},"withOverrides",[100,826,827],{"class":134},"({ CFCConfigPath: ",[100,829,830],{"class":361},"\"conf.LogBoxConfig\"",[100,832,833],{"class":134}," })\n",[100,835,836,838,841],{"class":102,"line":192},[100,837,821],{"class":134},[100,839,840],{"class":491},"done",[100,842,843],{"class":134},"()\n",[100,845,846,848,850,852,855,857,859,861,864],{"class":102,"line":200},[100,847,821],{"class":134},[100,849,798],{"class":491},[100,851,783],{"class":134},[100,853,854],{"class":361},"\"LogBox\"",[100,856,806],{"class":134},[100,858,809],{"class":491},[100,860,783],{"class":134},[100,862,863],{"class":361},"\"logbox.system.logging.LogBox\"",[100,865,451],{"class":134},[100,867,868,870,872,875,878,880,882],{"class":102,"line":212},[100,869,821],{"class":134},[100,871,824],{"class":491},[100,873,874],{"class":134},"({ config: di1.",[100,876,877],{"class":491},"getBean",[100,879,783],{"class":134},[100,881,803],{"class":361},[100,883,884],{"class":134},") });\n",[100,886,887],{"class":102,"line":222},[100,888,889],{"class":134},"        }\n",[100,891,892],{"class":102,"line":228},[100,893,710],{"class":134},[100,895,896],{"class":102,"line":610},[100,897,231],{"class":134},[10,899,900],{},"So we create an instance of LogBox's base LogBoxConfig object and pass in the path to our own config file as a parameter. We then create an instance of LogBox which takes the newly declared config object as its constructor.",[10,902,903,904,906,907,910],{},"There's one last piece to add to our ",[86,905,333],{},". Currently, we have only defined LogBox to be available from the LogBox subsystem bean factory. This means we would have to call an instance of it by doing ",[86,908,909],{},"getBeanFactory(\"logbox\").getBean(\"LogBox\")"," every time. For property injection to work across our application, we'll need to make it available to the parent bean factory.",[10,912,913,914,917],{},"In ",[86,915,916],{},"variables.framework",", we'll add the following:",[91,919,921],{"className":337,"code":920,"language":339,"meta":96,"style":96},"diConfig: {\n    loadListener: function(di1) {\n        di1.declare(\"Logger\").asValue(getBeanFactory(\"logbox\").getBean(\"LogBox\"));\n    }\n}\n",[86,922,923,930,945,983,987],{"__ignoreMap":96},[100,924,925,928],{"class":102,"line":103},[100,926,927],{"class":749},"diConfig",[100,929,159],{"class":134},[100,931,932,935,937,939,941,943],{"class":102,"line":110},[100,933,934],{"class":749},"    loadListener",[100,936,144],{"class":134},[100,938,780],{"class":487},[100,940,783],{"class":134},[100,942,787],{"class":786},[100,944,790],{"class":134},[100,946,947,950,952,954,957,959,962,964,967,969,972,974,976,978,980],{"class":102,"line":116},[100,948,949],{"class":134},"        di1.",[100,951,798],{"class":491},[100,953,783],{"class":134},[100,955,956],{"class":361},"\"Logger\"",[100,958,806],{"class":134},[100,960,961],{"class":491},"asValue",[100,963,783],{"class":134},[100,965,966],{"class":491},"getBeanFactory",[100,968,783],{"class":134},[100,970,971],{"class":361},"\"logbox\"",[100,973,806],{"class":134},[100,975,877],{"class":491},[100,977,783],{"class":134},[100,979,854],{"class":361},[100,981,982],{"class":134},"));\n",[100,984,985],{"class":102,"line":162},[100,986,710],{"class":134},[100,988,989],{"class":102,"line":175},[100,990,231],{"class":134},[10,992,993,994,997],{},"This declares a bean, called ",[86,995,996],{},"Logger"," (or whatever you'd like to call it), which holds an instance of the LogBox bean from the subsystem bean factory.",[10,999,1000],{},"Now we can inject the bean into a controller or service and use it like so:",[91,1002,1004],{"className":337,"code":1003,"language":339,"meta":96,"style":96},"// controllers.main\ncomponent accessors=true {\n    property Logger;\n\n    void function default(struct rc) {\n        Logger.getLogger(this).fatal(\"Oh no an error!\");\n    }\n}\n",[86,1005,1006,1011,1023,1028,1034,1053,1078,1082],{"__ignoreMap":96},[100,1007,1008],{"class":102,"line":103},[100,1009,1010],{"class":106},"// controllers.main\n",[100,1012,1013,1016,1018,1021],{"class":102,"line":110},[100,1014,1015],{"class":134},"component accessors",[100,1017,350],{"class":349},[100,1019,1020],{"class":618},"true",[100,1022,353],{"class":134},[100,1024,1025],{"class":102,"line":116},[100,1026,1027],{"class":134},"    property Logger;\n",[100,1029,1030],{"class":102,"line":162},[100,1031,1033],{"emptyLinePlaceholder":1032},true,"\n",[100,1035,1036,1038,1040,1043,1045,1048,1051],{"class":102,"line":175},[100,1037,484],{"class":349},[100,1039,488],{"class":487},[100,1041,1042],{"class":491}," default",[100,1044,783],{"class":134},[100,1046,1047],{"class":786},"struct",[100,1049,1050],{"class":786}," rc",[100,1052,790],{"class":134},[100,1054,1055,1058,1061,1063,1065,1067,1070,1072,1075],{"class":102,"line":186},[100,1056,1057],{"class":134},"        Logger.",[100,1059,1060],{"class":491},"getLogger",[100,1062,783],{"class":134},[100,1064,430],{"class":429},[100,1066,806],{"class":134},[100,1068,1069],{"class":491},"fatal",[100,1071,783],{"class":134},[100,1073,1074],{"class":361},"\"Oh no an error!\"",[100,1076,1077],{"class":134},");\n",[100,1079,1080],{"class":102,"line":192},[100,1081,710],{"class":134},[100,1083,1084],{"class":102,"line":200},[100,1085,231],{"class":134},[10,1087,1088,1089,1092,1093,1096,1097,1102],{},"In main.cfc, the Logger object uses ",[86,1090,1091],{},"getLogger(this)"," to get the logger we defined in LogBoxConfig and ",[86,1094,1095],{},"fatal(message)"," is used to used to log a \"fatal\" message. You can refer to ",[14,1098,1101],{"href":1099,"rel":1100},"https://logbox.ortusbooks.com/content/using_a_logger_object/",[18],"Using a Logger Object"," in the docs for more info on the various message methods.",[56,1104,1106],{"id":1105},"putting-it-all-together","Putting It All Together",[10,1108,1109],{},"Now that we have our application settings put together, we can use CommandBox to pull in our dependencies and start a server instance.",[10,1111,1112],{},"From the project directory run:",[91,1114,1119],{"className":1115,"code":1117,"language":1118},[1116],"language-text","#> install && start\n","text",[86,1120,1117],{"__ignoreMap":96},[10,1122,1123,1124,1129],{},"This will pull in Framework One and LogBox from ",[14,1125,1128],{"href":1126,"rel":1127},"https://www.forgebox.io/",[18],"ForgeBox",", start an instance of Lucee and open the application in a browser.",[10,1131,1132,1133,1136,1137,1140,1141,77],{},"Behind the scenes, the main controller was requested and executed the Logger methods for writing to the log file. If we check in ",[100,1134,1135],{},"project root","/logs we'll see ",[86,1138,1139],{},"MYTESTLOG.log"," was generated and contains the message passed to ",[86,1142,1143],{},"fatal()",[56,1145,1147],{"id":1146},"whats-next","What's Next?",[10,1149,1150],{},"With a working instance of LogBox that you can pass around to your controllers and services, the logging options are endless.",[10,1152,1153,1154,1159],{},"Refer to the ",[14,1155,1158],{"href":1156,"rel":1157},"https://logbox.ortusbooks.com/content/",[18],"documentation"," on how to further customize the configuration and utilize the object functions for logging.",[10,1161,1162,1163,77],{},"To see the above setup in action, you can download an ",[14,1164,1167],{"href":1165,"rel":1166},"https://github.com/tonyjunkes/fw1-logbox-example",[18],"example project from GitHub",[10,1169,1170],{},"Cheers.",[1172,1173,1174],"style",{},"html pre.shiki code .sq-8i, html code.shiki .sq-8i{--shiki-light:#6A737D;--shiki-default:#6A737D;--shiki-dark:#6A737D;--shiki-sepia:#88846F}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html .sepia .shiki span {color: var(--shiki-sepia);background: var(--shiki-sepia-bg);font-style: var(--shiki-sepia-font-style);font-weight: var(--shiki-sepia-font-weight);text-decoration: var(--shiki-sepia-text-decoration);}html.sepia .shiki span {color: var(--shiki-sepia);background: var(--shiki-sepia-bg);font-style: var(--shiki-sepia-font-style);font-weight: var(--shiki-sepia-font-weight);text-decoration: var(--shiki-sepia-text-decoration);}html pre.shiki code .s__4a, html code.shiki .s__4a{--shiki-light:#24292E;--shiki-default:#E1E4E8;--shiki-dark:#E1E4E8;--shiki-sepia:#F8F8F2}html pre.shiki code .sHysA, html code.shiki .sHysA{--shiki-light:#005CC5;--shiki-light-font-style:inherit;--shiki-default:#79B8FF;--shiki-default-font-style:inherit;--shiki-dark:#79B8FF;--shiki-dark-font-style:inherit;--shiki-sepia:#66D9EF;--shiki-sepia-font-style:italic}html pre.shiki code .sSnWl, html code.shiki .sSnWl{--shiki-light:#032F62;--shiki-default:#9ECBFF;--shiki-dark:#9ECBFF;--shiki-sepia:#CFCFC2}html pre.shiki code .sOw68, html code.shiki .sOw68{--shiki-light:#D73A49;--shiki-default:#F97583;--shiki-dark:#F97583;--shiki-sepia:#F92672}html pre.shiki code .svw4x, html code.shiki .svw4x{--shiki-light:#032F62;--shiki-default:#9ECBFF;--shiki-dark:#9ECBFF;--shiki-sepia:#E6DB74}html pre.shiki code .s0XdW, html code.shiki .s0XdW{--shiki-light:#005CC5;--shiki-default:#79B8FF;--shiki-dark:#79B8FF;--shiki-sepia:#FD971F}html pre.shiki code .seVH3, html code.shiki .seVH3{--shiki-light:#D73A49;--shiki-light-font-style:inherit;--shiki-default:#F97583;--shiki-default-font-style:inherit;--shiki-dark:#F97583;--shiki-dark-font-style:inherit;--shiki-sepia:#66D9EF;--shiki-sepia-font-style:italic}html pre.shiki code .s9ihy, html code.shiki .s9ihy{--shiki-light:#6F42C1;--shiki-default:#B392F0;--shiki-dark:#B392F0;--shiki-sepia:#A6E22E}html pre.shiki code .sqGHR, html code.shiki .sqGHR{--shiki-light:#6F42C1;--shiki-light-text-decoration:inherit;--shiki-default:#B392F0;--shiki-default-text-decoration:inherit;--shiki-dark:#B392F0;--shiki-dark-text-decoration:inherit;--shiki-sepia:#A6E22E;--shiki-sepia-text-decoration:underline}html pre.shiki code .sYoJV, html code.shiki .sYoJV{--shiki-light:#E36209;--shiki-default:#FFAB70;--shiki-dark:#FFAB70;--shiki-sepia:#F8F8F2}html pre.shiki code .s-7EV, html code.shiki .s-7EV{--shiki-light:#005CC5;--shiki-default:#79B8FF;--shiki-dark:#79B8FF;--shiki-sepia:#AE81FF}html pre.shiki code .sO2oV, html code.shiki .sO2oV{--shiki-light:#6F42C1;--shiki-default:#B392F0;--shiki-dark:#B392F0;--shiki-sepia:#F8F8F2}html pre.shiki code .sYQ0Z, html code.shiki .sYQ0Z{--shiki-light:#E36209;--shiki-light-font-style:inherit;--shiki-default:#FFAB70;--shiki-default-font-style:inherit;--shiki-dark:#FFAB70;--shiki-dark-font-style:inherit;--shiki-sepia:#FD971F;--shiki-sepia-font-style:italic}",{"title":96,"searchDepth":110,"depth":110,"links":1176},[1177,1178,1181,1182],{"id":24,"depth":116,"text":25},{"id":58,"depth":110,"text":59,"children":1179},[1180],{"id":62,"depth":116,"text":63},{"id":1105,"depth":110,"text":1106},{"id":1146,"depth":110,"text":1147},"2017-09-16","I've seen talk of FW/1 and LogBox integration come up a few times on the CFML Slack, so I figured I'd run through a way to get that set up in your application and start using it.",{},"/blog/2017-09-16-using-logbox-for-logging-in-fw1",{"title":5,"description":1184},"using-logbox-for-logging-in-fw1","blog/2017-09-16-using-logbox-for-logging-in-fw1",[1191,1192,35],"CFML","FW1","YbEGMDcFuTs9G_8T1Kdcx0feefavlXLg0mXW9kpGz6Y"]