Return-Path: X-Original-To: apmail-logging-log4j-dev-archive@www.apache.org Delivered-To: apmail-logging-log4j-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 57E3F18488 for ; Fri, 7 Aug 2015 08:19:48 +0000 (UTC) Received: (qmail 76519 invoked by uid 500); 7 Aug 2015 08:19:48 -0000 Delivered-To: apmail-logging-log4j-dev-archive@logging.apache.org Received: (qmail 76463 invoked by uid 500); 7 Aug 2015 08:19:47 -0000 Mailing-List: contact log4j-dev-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Log4J Developers List" Reply-To: "Log4J Developers List" Delivered-To: mailing list log4j-dev@logging.apache.org Received: (qmail 76422 invoked by uid 99); 7 Aug 2015 08:19:47 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Aug 2015 08:19:47 +0000 Date: Fri, 7 Aug 2015 08:19:47 +0000 (UTC) From: =?utf-8?Q?Mikael_St=C3=A5ldal_=28JIRA=29?= To: log4j-dev@logging.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (LOG4J2-599) Support lambda functions (or similar) for log message parameters MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/LOG4J2-599?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1466= 1487#comment-14661487 ]=20 Mikael St=C3=A5ldal commented on LOG4J2-599: --------------------------------------- An argument for going with technology based name {{Java8Logger}} is that yo= u might need to do it differently to achieve the same functionality with di= fferent technologies. {{Java8Logger}}, {{ScalaLogger}}, {{GroovyLogger}}, ... On the other hand, it's probably better to differentiate them by different = packages, and perhaps even different modules, and then you import the one y= ou need. I would prefer {{LazyLogger}} over {{LambdaLogger}} since you would most li= kely use string interpolation and macros (rather than lambdas) to achieve i= t in Scala. > Support lambda functions (or similar) for log message parameters > ---------------------------------------------------------------- > > Key: LOG4J2-599 > URL: https://issues.apache.org/jira/browse/LOG4J2-599 > Project: Log4j 2 > Issue Type: Brainstorming > Components: Core > Reporter: Matt Sicker > Priority: Minor > Labels: Java8 > > It would be nice if we could support 0-param lambda functions (or the equ= ivalent: interfaces with a single empty-parameter message call), or more si= mply, allow Runnables (or something similar) to be passed which will be dyn= amically executed if the log message is enabled. > The use case here is that although string construction of the log message= is a performance issue that is already solved quite well, the problem of a= dding in information to the log message that makes other calculations still= needs to be wrapped in an if check. > I'm not sure if it'd be best to just use Runnable, or create a new interf= ace, or try to emulate how Java 1.8 lambdas work via an interface with a si= ngle method defined. The details here would still need to be fleshed out, b= ut I think this sort of feature could be rather handy (especially in a Java= 1.8+ environment, or in Groovy/Scala/etc.). -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-dev-help@logging.apache.org