devexperts / devexperts/QD

Logging: support lazy construction of message

Open
#4 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
65
Forks
20
PR merge metrics
No merged PRs in 30d

Description

A frequent pattern of using `com.devexperts.logging.Logging#debug(java.lang.String)` is (example from `dxfeed-api/src/main/java/com/dxfeed/ipf/live/InstrumentProfileCollector.java`):
```java
if (log.debugEnabled())
log.debug("Removing " + debugString(entry.ip));
```
— this is supposedly done to avoid resource-intensive computation of message, which is justified, but can be considered boilerplate.

Raw log4j2 addresses this by providing lambda-accepting methods such as `org.apache.logging.log4j.Logger#debug(org.apache.logging.log4j.util.Supplier)`. It would be nice if `com.devexperts.logging.Logging` supported this as well.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with com.devexperts.logging.Logging#debug(java.lang.String) and the usage in dxfeed-api/src/main/java/com/dxfeed/ipf/live/InstrumentProfileCollector.java. Inspect the existing logging API and its debug-enabled behavior, then determine the supported lazy message form; done means expensive message construction is skipped when debug logging is disabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
observability-sre
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.