Skip to content

Commit

Permalink
improve recipe for monitoring
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Jun 9, 2024
1 parent 66df8d8 commit b69396d
Showing 1 changed file with 45 additions and 25 deletions.
70 changes: 45 additions & 25 deletions docs/recipes/monitoring-enable-for-your-session.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<cfsetting showDebugOutput="true|false">` 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;
}
```
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.

0 comments on commit b69396d

Please sign in to comment.