You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/recipes/logging.md
+37-8Lines changed: 37 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -95,32 +95,30 @@ Lucee also provides the following layouts for customizing log output:
95
95
-**classic**: Produces traditional CFML-compatible output.
96
96
-**datadog**: Formats logs for direct ingestion into **Datadog**.
97
97
-**html**: Outputs logs in an HTML format suitable for browser-based debugging.
98
-
-**json**: Generates logs in structured JSON format.
98
+
-**json**: Generates logs in structured JSON format (uses Log4j2's JSONAppender internally).
99
99
-**pattern**: Allows custom patterns for maximum flexibility.
100
100
-**xml**: Outputs logs in structured XML format.
101
101
102
102
---
103
103
104
104
## Extending Logging with Custom Appenders and Layouts
105
105
106
-
In addition to the built-in appenders and layouts, Lucee supports custom configurations using third-party libraries.
107
-
You can use OSGi based libraries or classic java libraries (Maven support will follow soon).
108
-
Here’s how you can define custom appenders and layouts:
106
+
In addition to the built-in appenders and layouts, Lucee supports custom configurations using third-party libraries. Here’s how you can define custom appenders and layouts:
109
107
110
108
### Custom Appender Configuration
111
109
112
110
```json
113
111
"appenderClass": "<custom-appender-class-name>",
114
-
"appenderBundleName": "<custom-appender-osgi-bundle-name>",// only needed for OSGi based libraries
115
-
"appenderBundleVersion": "<custom-appender-osgi-bundle-version>"// only needed for OSGi based libraries
@@ -150,4 +148,35 @@ This configuration sends logs to a Kafka topic with a custom pattern layout.
150
148
151
149
---
152
150
151
+
## Using the `<cflog>` Tag
152
+
153
+
Lucee supports logging through the `<cflog>` tag, which allows you to send log entries to specific loggers. The tag is available in both **HTML-style** and **script-style** syntax.
154
+
155
+
### Examples
156
+
157
+
#### HTML-Style Syntax
158
+
159
+
```html
160
+
<cfloglog="application"type="warn"text="Warning: Something went wrong!">
161
+
```
162
+
163
+
#### Script-Style Syntax (Migration)
164
+
165
+
```javascript
166
+
log log="application" type="warn" text="Warning: Something went wrong!";
Lucee's `<cflog>` tag supports various attributes, including `log`, `type`, `text`, and `exception`. Using these attributes, you can customize log entries to suit your application's needs.
181
+
153
182
Lucee’s extensible logging framework offers flexibility for integrating with diverse infrastructures, enhancing monitoring, debugging, and auditing capabilities. By leveraging built-in features and custom configurations, you can adapt the logging system to your application's unique needs.
0 commit comments