Skip to content

Logging: support lazy construction of message #4

@dtruebin

Description

@dtruebin

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

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions