Peter Hoopes
07/16/2022, 12:46 AMapplication
scope makes sense, but in the demos (and in the docs) the pages create a new log
object from application.LogBox
and then run its methods. Do I have to create a new log
object on each page or can there be something else in a broader scope? I’d like to just be able to call the log.error();
commands where needed. Either I’m dumb and should know that I have to create the log
object or there’s another place to put it. Any pointers would be appreciated.bdw429s
07/16/2022, 2:38 AMbdw429s
07/16/2022, 2:38 AMbdw429s
07/16/2022, 2:38 AMlogbox.getLogger( 'foo' )
then that's not "creating a new logger", it's just giving you the logger you asked for.bdw429s
07/16/2022, 2:38 AMbdw429s
07/16/2022, 2:39 AMvariables.log = application.logbox.getLogger( this );
in the init()
for that CFC and from then on out, you can just run
<http://log.info|log.info>()
when you wantbdw429s
07/16/2022, 2:39 AMPeter Hoopes
07/16/2022, 2:55 AMlog = application.logbox.getRootLogger();
is what I’m wondering about. Much of my app is still CFM based (being rewritten), so I guess I’ll need to call that on each page. I think I understand now…. thanks.bdw429s
07/16/2022, 3:13 AMbdw429s
07/16/2022, 3:13 AMPeter Hoopes
07/16/2022, 3:16 AMbdw429s
07/16/2022, 3:18 AMbdw429s
07/16/2022, 3:18 AMbdw429s
07/16/2022, 3:19 AMbdw429s
07/16/2022, 3:19 AMbdw429s
07/16/2022, 3:20 AMapplication.logbox.getLogger( this );
then the name of the logger is <http://path.to|path.to>.your.cfc
instead of just root
bdw429s
07/16/2022, 3:20 AMbdw429s
07/16/2022, 3:21 AMapplication.logbox.getLogger( 'shoppingcart' );
application.logbox.getLogger( 'login' );
application.logbox.getLogger( 'dashboard' );
and that will be the category namePeter Hoopes
07/16/2022, 3:31 AM