From b69396db0a340c211241bba14ac2f7ab88dd61f0 Mon Sep 17 00:00:00 2001 From: michaeloffner Date: Sun, 9 Jun 2024 18:08:14 +0200 Subject: [PATCH] improve recipe for monitoring --- .../monitoring-enable-for-your-session.md | 70 ++++++++++++------- 1 file changed, 45 insertions(+), 25 deletions(-) diff --git a/docs/recipes/monitoring-enable-for-your-session.md b/docs/recipes/monitoring-enable-for-your-session.md index 84320c4d6..934df85b7 100644 --- a/docs/recipes/monitoring-enable-for-your-session.md +++ b/docs/recipes/monitoring-enable-for-your-session.md @@ -13,38 +13,58 @@ ] } --> + # Monitoring - Enable for your session -This shows you a way to enable Monitoring for your session, this only works with Lucee 6.1 and above. -In Lucee 6.1 you can not only enable/disable that debugging is shown in the Website, you can also enable debugging, or better the different debug options in the Application.cfc (or Environment Variables), without having any negative performance impact for other. -Still per carful with deploying this to a public facing server, because this will expose information about the web server. +This guide demonstrates how to enable monitoring for your session in Lucee 6.1 and above. Prior to Lucee 6.1, you could only enable or disable the display of debugging information using the `` tag. However, Lucee 6.1 introduces the ability to enable debugging itself directly in the `Application.cfc`. -So you simply add the following code in your Application.cfc -```lucee +**Note:** Be cautious when deploying this to a public-facing server, as it may expose sensitive information about your web server when not used correctly. - if(!isNull(url.show) || isNull(session.show)) { - session.show=url.show?:true; - } +## Enabling/Disable Monitoring - this.monitoring.showDebug = session.show; - this.monitoring.showDoc = session.show; - this.monitoring.showMetric = session.show; +To enable or disable monitoring for your session, add the following code to your `Application.cfc`: + +```lucee +if (!isNull(url.show) || isNull(session.show)) { + session.show = url.show ?: true; +} - this.monitoring.debuggingTemplate = session.show; - this.monitoring.debuggingDatabase = session.show; - this.monitoring.debuggingException = session.show; - this.monitoring.debuggingTracing = session.show; - this.monitoring.debuggingDump = session.show; - this.monitoring.debuggingTimer = session.show; - this.monitoring.debuggingImplicitAccess = session.show; - this.monitoring.debuggingThread = session.show; +this.monitoring.showDebug = session.show; +this.monitoring.showDoc = session.show; +this.monitoring.showMetric = session.show; +this.monitoring.debuggingTemplate = session.show; +this.monitoring.debuggingDatabase = session.show; +this.monitoring.debuggingException = session.show; +this.monitoring.debuggingTracing = session.show; +this.monitoring.debuggingDump = session.show; +this.monitoring.debuggingTimer = session.show; +this.monitoring.debuggingImplicitAccess = session.show; +this.monitoring.debuggingThread = session.show; ``` -Then you add `show=true` to show the debugging or `show=false` to disable it again. -Of course you can lock that down a bit, by requesting a more specific string. +## Activating and Deactivating Debugging + +To show debugging, add `show=true` to the URL. To disable debugging, add `show=false` to the URL. + +For example: +- Enable debugging: `https://yourdomain.com?show=true` +- Disable debugging: `https://yourdomain.com?show=false` + +## Enhanced Security + +To enhance security, you can use a more specific string in the URL: + ```lucee - if(!isNull(url.fsdfsdfdfgdgdfs) || isNull(session.show)) { - session.show=url.fsdfsdfdfgdgdfs?:true; - } -``` \ No newline at end of file +if (!isNull(url.fsdfsdfdfgdgdfs) || isNull(session.show)) { + session.show = url.fsdfsdfdfgdgdfs ?: true; +} +``` + +In this case, use `fsdfsdfdfgdgdfs=true` to enable debugging and `fsdfsdfdfgdgdfs=false` to disable it. + +For example: +- Enable debugging: `https://yourdomain.com?fsdfsdfdfgdgdfs=true` +- Disable debugging: `https://yourdomain.com?fsdfsdfdfgdgdfs=false` + +This additional string requirement helps ensure that only those who know the specific string can enable or disable debugging.