Skip to content

Commit

Permalink
cross ref and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
zspitzer committed Jan 17, 2025
1 parent 1d5c4ca commit dc15ce5
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 15 deletions.
15 changes: 10 additions & 5 deletions docs/recipes/java-in-functions-and-closures.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
],
"categories": [
"java"
],
"related": [
"tag-function"
]
}
-->
Expand All @@ -22,9 +25,9 @@

You can write CFML code directly in a function or a closure.

## Function
## Functions

Inside the function, you write regular Java code. The arguments and return type definition must be Java types.
Inside the function, you can write regular Java code. The arguments and return type definition must be Java types.

```lucee
int function echoInt(int i) type="java" {
Expand All @@ -33,7 +36,7 @@ int function echoInt(int i) type="java" {
}
```

## Component
## Components

Of course, the function can also be part of a component.

Expand All @@ -46,9 +49,11 @@ component {
}
```

## Java Lambda Function
## Java Lambda Functions

If the interface of a function matches a functional Java interface (Lambda), Lucee automatically implements that interface.

If the interface of a function matches a functional Java interface (Lambda), Lucee automatically implements that interface. In the following example, we implement the `IntUnaryOperator` implicitly. You can then pass it to Java and use it as such.
In the following example, we implement the `IntUnaryOperator` implicitly. You can then pass it to Java and use it as such.

```lucee
int function echoInt(int i) type="java" {
Expand Down
3 changes: 3 additions & 0 deletions docs/recipes/java-libraries.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
],
"categories": [
"java"
],
"related": [
"maven"
]
}
-->
Expand Down
38 changes: 29 additions & 9 deletions docs/recipes/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,27 @@
{
"title": "Logging",
"id": "logging",
"description": "",
"description": "How to configure and customize logging",
"keywords": [
"Logging",
"Log levels",
"Lucee"
],
"related": [
"tag-log",
"function-writelog"
],
"categories": [
"server"
]
}
-->

# Logging in Lucee

Lucee's logging system is a powerful and flexible framework designed to provide insights into your application’s behavior. By configuring logs, you can monitor errors, track events, and troubleshoot efficiently.
Lucee's logging system is a powerful and flexible framework designed to provide insights into your application’s behavior.

By configuring logs, you can monitor errors, track events, and troubleshoot efficiently.

## Why Logging?

Expand All @@ -23,7 +32,9 @@ Logging is an essential practice for maintaining reliable and performant applica
- Gain insights into application usage and performance.
- Maintain an audit trail of events and actions.

Lucee supports various log types (or levels), enabling you to control the verbosity and focus of your logs. Additionally, you can configure logging destinations and formats to integrate seamlessly with your infrastructure.
Lucee supports various log types (or levels), enabling you to control the verbosity and focus of your logs.

Additionally, you can configure logging destinations and formats to integrate seamlessly with your infrastructure.

## How to Use Log Levels?

Expand All @@ -38,7 +49,9 @@ Log levels (or types) categorize log entries based on their importance or severi

### Configuring Log Level Thresholds

You can configure the minimum log level (threshold) for each logger in the **Lucee Administrator** or directly in the configuration file (`.CFConfig.json`). For instance, setting a threshold of `warn` means only warnings, errors, and fatal logs are recorded, ignoring `info`, `debug`, and `trace` logs.
You can configure the minimum log level (threshold) for each logger in the **Lucee Administrator** or directly in the configuration file (`.CFConfig.json`).

For instance, setting a threshold of `warn` means only warnings, errors, and fatal logs are recorded, ignoring `info`, `debug`, and `trace` logs.

This allows you to start with minimal logging in production and increase verbosity (e.g., to `debug`) for deeper analysis when needed.

Expand Down Expand Up @@ -75,23 +88,25 @@ You can add, modify, or remove loggers in the **Lucee Administrator** or directl

### Internals: Powered by Log4j2

Lucee's logging system is powered by **Log4j2**, providing robust support for appenders and layouts. You can extend Lucee logging by using any appender or layout supported by Log4j2.
Lucee's logging system is powered by **Log4j2**, providing robust support for Appenders and Layouts.

You can extend Lucee logging by using any Appender or Layout supported by Log4j2.

---

## Built-in Support for Appenders and Layouts

### Built-in Appenders

Lucee comes with built-in support for the following appenders:
Lucee comes with built-in support for the following Appenders:

- **console**: Logs output to the console, ideal for debugging in development or server environments.
- **datasource**: Logs to a database table, allowing structured storage and querying of log data.
- **resource**: Logs to a virtual filesystem endpoint, which can include local filesystems or external systems like **S3**, FTP, etc.

### Built-in Layouts

Lucee also provides the following layouts for customizing log output:
Lucee also provides the following Layouts for customizing log output:

- **classic**: Produces traditional CFML-compatible output.
- **datadog**: Formats logs for direct ingestion into **Datadog**.
Expand All @@ -104,7 +119,9 @@ Lucee also provides the following layouts for customizing log output:

## Extending Logging with Custom Appenders and Layouts

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:
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:

### Custom Appender Configuration

Expand Down Expand Up @@ -145,7 +162,7 @@ In addition to the built-in appenders and layouts, Lucee supports custom configu
}
```

This configuration sends logs to a Kafka topic with a custom pattern layout.
This configuration sends logs to a Kafka topic with a custom pattern Layout.

---

Expand Down Expand Up @@ -177,6 +194,9 @@ catch(e) {
cflog(log="application", type="error", exception=e);
}
```
(Due to the existing math log function, the cf prefix is still required here, unlike with other tags in script.)



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.

Expand Down
2 changes: 1 addition & 1 deletion docs/recipes/maven.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ In `.CFConfig.json`, you can define Maven dependencies that will be used globall

The `version` attribute is optional. If not specified, Lucee will automatically fetch the latest version available for the specified Maven artifact.

In addition, we also support the more concise Gradle style format.
In addition, we also support the more concise Gradle style.

```json
{
Expand Down

0 comments on commit dc15ce5

Please sign in to comment.