You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Matt Sicker <bo...@gmail.com> on 2016/09/01 02:32:54 UTC

Re: With the upcoming Scala support, shall we start investigating general polyglot support?

The amount of support code Lombok has to abuse the annotation processor the
way it does makes it seem like it should remain outside log4j. The lack of
a need for Groovy-specific code is because Groovy is very similar to Java.
Even without the annotations, you could do something like:

class Foo {
    static Logger log = LogManager.logger
    // ...
}

A small list of JVM languages that may be worth documenting or providing
small compatibility modules for are:

* Scala (already completed)
* Clojure
* Kotlin
* Ceylon
* JRuby
* Jython
* JavaScript (Rhino or Nashorn)

I know there are more JVM languages out there, but those cover the main
production ones I've ever seen. Vert.x is a good example of a Java
framework that supports most of those languages in idiomatic ways.

On 31 August 2016 at 10:45, Gary Gregory <ga...@gmail.com> wrote:

> I like the idea of Lombok and doing more with annotations and having to
> write less code as a user.
>
> Gary
>
> On Wed, Aug 31, 2016 at 8:03 AM, Mikael Ståldal <mikael.staldal@magine.com
> > wrote:
>
>> Then we probably not have to do anything for Groovy. But maybe for Kotlin.
>>
>> Another language to consider would be Clojure.
>>
>> On Wed, Aug 31, 2016 at 4:54 PM, Matt Sicker <bo...@gmail.com> wrote:
>>
>>> I know Groovy already has a built-in feature that makes using Log4j 2
>>> easier:
>>>
>>> http://docs.groovy-lang.org/latest/html/gapi/groovy/util/log
>>> ging/Log4j2.html
>>>
>>> And that's pretty similar to the Lombok feature:
>>>
>>> https://projectlombok.org/features/Log.html
>>>
>>> On 31 August 2016 at 03:36, Mikael Ståldal <mi...@magine.com>
>>> wrote:
>>>
>>>> Could make sense. Otherwise people will probably create and use
>>>> libraries like https://github.com/MicroUtils/kotlin-logging which
>>>> links to SLF4J.
>>>>
>>>> On Tue, Aug 30, 2016 at 8:21 PM, Matt Sicker <bo...@gmail.com> wrote:
>>>>
>>>>> I'm currently interesting in a few JVM languages, and besides Groovy,
>>>>> each language seems to have their own idiomatic ways of handling things
>>>>> that are just slightly different enough from Java to either warrant a
>>>>> separate module (like the Scala one) or at least documenting how to use it
>>>>> in such a language. For instance, some details on using Log4j in Kotlin: <
>>>>> https://stackoverflow.com/questions/34416869/idiomatic-way-
>>>>> of-logging-in-kotlin>.
>>>>>
>>>>> I'm not familiar enough with any of the languages to really make good
>>>>> recommendations yet, but I think it might be worthwhile to start
>>>>> documenting support in other JVM languages. What do you guys think?
>>>>>
>>>>> --
>>>>> Matt Sicker <bo...@gmail.com>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> [image: MagineTV]
>>>>
>>>> *Mikael Ståldal*
>>>> Senior software developer
>>>>
>>>> *Magine TV*
>>>> mikael.staldal@magine.com
>>>> Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com
>>>>
>>>> Privileged and/or Confidential Information may be contained in this
>>>> message. If you are not the addressee indicated in this message
>>>> (or responsible for delivery of the message to such a person), you may
>>>> not copy or deliver this message to anyone. In such case,
>>>> you should destroy this message and kindly notify the sender by reply
>>>> email.
>>>>
>>>
>>>
>>>
>>> --
>>> Matt Sicker <bo...@gmail.com>
>>>
>>
>>
>>
>> --
>> [image: MagineTV]
>>
>> *Mikael Ståldal*
>> Senior software developer
>>
>> *Magine TV*
>> mikael.staldal@magine.com
>> Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com
>>
>> Privileged and/or Confidential Information may be contained in this
>> message. If you are not the addressee indicated in this message
>> (or responsible for delivery of the message to such a person), you may
>> not copy or deliver this message to anyone. In such case,
>> you should destroy this message and kindly notify the sender by reply
>> email.
>>
>
>
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition
> <http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>



-- 
Matt Sicker <bo...@gmail.com>

Re: With the upcoming Scala support, shall we start investigating general polyglot support?

Posted by Matt Sicker <bo...@gmail.com>.
Oh right. Groovy has some docs already, but it'd be useful to mention it in
our docs, too.

On 1 September 2016 at 11:34, Mikael Ståldal <mi...@magine.com>
wrote:

> A small list of JVM languages that may be worth documenting or providing
>> small compatibility modules for are:
>> * Scala (already completed)
>> * Clojure
>> * Kotlin
>> * Ceylon
>> * JRuby
>> * Jython
>> * JavaScript (Rhino or Nashorn)
>
>
> Seems reasonable, if you add Groovy to the list. Not sure how popular
> Ceylon actually is.
>
> On Thu, Sep 1, 2016 at 4:32 AM, Matt Sicker <bo...@gmail.com> wrote:
>
>> The amount of support code Lombok has to abuse the annotation processor
>> the way it does makes it seem like it should remain outside log4j. The lack
>> of a need for Groovy-specific code is because Groovy is very similar to
>> Java. Even without the annotations, you could do something like:
>>
>> class Foo {
>>     static Logger log = LogManager.logger
>>     // ...
>> }
>>
>> A small list of JVM languages that may be worth documenting or providing
>> small compatibility modules for are:
>>
>> * Scala (already completed)
>> * Clojure
>> * Kotlin
>> * Ceylon
>> * JRuby
>> * Jython
>> * JavaScript (Rhino or Nashorn)
>>
>> I know there are more JVM languages out there, but those cover the main
>> production ones I've ever seen. Vert.x is a good example of a Java
>> framework that supports most of those languages in idiomatic ways.
>>
>> On 31 August 2016 at 10:45, Gary Gregory <ga...@gmail.com> wrote:
>>
>>> I like the idea of Lombok and doing more with annotations and having to
>>> write less code as a user.
>>>
>>> Gary
>>>
>>> On Wed, Aug 31, 2016 at 8:03 AM, Mikael Ståldal <
>>> mikael.staldal@magine.com> wrote:
>>>
>>>> Then we probably not have to do anything for Groovy. But maybe for
>>>> Kotlin.
>>>>
>>>> Another language to consider would be Clojure.
>>>>
>>>> On Wed, Aug 31, 2016 at 4:54 PM, Matt Sicker <bo...@gmail.com> wrote:
>>>>
>>>>> I know Groovy already has a built-in feature that makes using Log4j 2
>>>>> easier:
>>>>>
>>>>> http://docs.groovy-lang.org/latest/html/gapi/groovy/util/log
>>>>> ging/Log4j2.html
>>>>>
>>>>> And that's pretty similar to the Lombok feature:
>>>>>
>>>>> https://projectlombok.org/features/Log.html
>>>>>
>>>>> On 31 August 2016 at 03:36, Mikael Ståldal <mi...@magine.com>
>>>>> wrote:
>>>>>
>>>>>> Could make sense. Otherwise people will probably create and use
>>>>>> libraries like https://github.com/MicroUtils/kotlin-logging which
>>>>>> links to SLF4J.
>>>>>>
>>>>>> On Tue, Aug 30, 2016 at 8:21 PM, Matt Sicker <bo...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> I'm currently interesting in a few JVM languages, and besides
>>>>>>> Groovy, each language seems to have their own idiomatic ways of handling
>>>>>>> things that are just slightly different enough from Java to either warrant
>>>>>>> a separate module (like the Scala one) or at least documenting how to use
>>>>>>> it in such a language. For instance, some details on using Log4j in Kotlin:
>>>>>>> <https://stackoverflow.com/questions/34416869/idiomatic-way-
>>>>>>> of-logging-in-kotlin>.
>>>>>>>
>>>>>>> I'm not familiar enough with any of the languages to really make
>>>>>>> good recommendations yet, but I think it might be worthwhile to start
>>>>>>> documenting support in other JVM languages. What do you guys think?
>>>>>>>
>>>>>>> --
>>>>>>> Matt Sicker <bo...@gmail.com>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> [image: MagineTV]
>>>>>>
>>>>>> *Mikael Ståldal*
>>>>>> Senior software developer
>>>>>>
>>>>>> *Magine TV*
>>>>>> mikael.staldal@magine.com
>>>>>> Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com
>>>>>>
>>>>>> Privileged and/or Confidential Information may be contained in this
>>>>>> message. If you are not the addressee indicated in this message
>>>>>> (or responsible for delivery of the message to such a person), you
>>>>>> may not copy or deliver this message to anyone. In such case,
>>>>>> you should destroy this message and kindly notify the sender by reply
>>>>>> email.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Matt Sicker <bo...@gmail.com>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> [image: MagineTV]
>>>>
>>>> *Mikael Ståldal*
>>>> Senior software developer
>>>>
>>>> *Magine TV*
>>>> mikael.staldal@magine.com
>>>> Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com
>>>>
>>>> Privileged and/or Confidential Information may be contained in this
>>>> message. If you are not the addressee indicated in this message
>>>> (or responsible for delivery of the message to such a person), you may
>>>> not copy or deliver this message to anyone. In such case,
>>>> you should destroy this message and kindly notify the sender by reply
>>>> email.
>>>>
>>>
>>>
>>>
>>> --
>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>> Java Persistence with Hibernate, Second Edition
>>> <http://www.manning.com/bauer3/>
>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>> Spring Batch in Action <http://www.manning.com/templier/>
>>> Blog: http://garygregory.wordpress.com
>>> Home: http://garygregory.com/
>>> Tweet! http://twitter.com/GaryGregory
>>>
>>
>>
>>
>> --
>> Matt Sicker <bo...@gmail.com>
>>
>
>
>
> --
> [image: MagineTV]
>
> *Mikael Ståldal*
> Senior software developer
>
> *Magine TV*
> mikael.staldal@magine.com
> Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com
>
> Privileged and/or Confidential Information may be contained in this
> message. If you are not the addressee indicated in this message
> (or responsible for delivery of the message to such a person), you may not
> copy or deliver this message to anyone. In such case,
> you should destroy this message and kindly notify the sender by reply
> email.
>



-- 
Matt Sicker <bo...@gmail.com>

Re: With the upcoming Scala support, shall we start investigating general polyglot support?

Posted by Mikael Ståldal <mi...@magine.com>.
>
> A small list of JVM languages that may be worth documenting or providing
> small compatibility modules for are:
> * Scala (already completed)
> * Clojure
> * Kotlin
> * Ceylon
> * JRuby
> * Jython
> * JavaScript (Rhino or Nashorn)


Seems reasonable, if you add Groovy to the list. Not sure how popular
Ceylon actually is.

On Thu, Sep 1, 2016 at 4:32 AM, Matt Sicker <bo...@gmail.com> wrote:

> The amount of support code Lombok has to abuse the annotation processor
> the way it does makes it seem like it should remain outside log4j. The lack
> of a need for Groovy-specific code is because Groovy is very similar to
> Java. Even without the annotations, you could do something like:
>
> class Foo {
>     static Logger log = LogManager.logger
>     // ...
> }
>
> A small list of JVM languages that may be worth documenting or providing
> small compatibility modules for are:
>
> * Scala (already completed)
> * Clojure
> * Kotlin
> * Ceylon
> * JRuby
> * Jython
> * JavaScript (Rhino or Nashorn)
>
> I know there are more JVM languages out there, but those cover the main
> production ones I've ever seen. Vert.x is a good example of a Java
> framework that supports most of those languages in idiomatic ways.
>
> On 31 August 2016 at 10:45, Gary Gregory <ga...@gmail.com> wrote:
>
>> I like the idea of Lombok and doing more with annotations and having to
>> write less code as a user.
>>
>> Gary
>>
>> On Wed, Aug 31, 2016 at 8:03 AM, Mikael Ståldal <
>> mikael.staldal@magine.com> wrote:
>>
>>> Then we probably not have to do anything for Groovy. But maybe for
>>> Kotlin.
>>>
>>> Another language to consider would be Clojure.
>>>
>>> On Wed, Aug 31, 2016 at 4:54 PM, Matt Sicker <bo...@gmail.com> wrote:
>>>
>>>> I know Groovy already has a built-in feature that makes using Log4j 2
>>>> easier:
>>>>
>>>> http://docs.groovy-lang.org/latest/html/gapi/groovy/util/log
>>>> ging/Log4j2.html
>>>>
>>>> And that's pretty similar to the Lombok feature:
>>>>
>>>> https://projectlombok.org/features/Log.html
>>>>
>>>> On 31 August 2016 at 03:36, Mikael Ståldal <mi...@magine.com>
>>>> wrote:
>>>>
>>>>> Could make sense. Otherwise people will probably create and use
>>>>> libraries like https://github.com/MicroUtils/kotlin-logging which
>>>>> links to SLF4J.
>>>>>
>>>>> On Tue, Aug 30, 2016 at 8:21 PM, Matt Sicker <bo...@gmail.com> wrote:
>>>>>
>>>>>> I'm currently interesting in a few JVM languages, and besides Groovy,
>>>>>> each language seems to have their own idiomatic ways of handling things
>>>>>> that are just slightly different enough from Java to either warrant a
>>>>>> separate module (like the Scala one) or at least documenting how to use it
>>>>>> in such a language. For instance, some details on using Log4j in Kotlin: <
>>>>>> https://stackoverflow.com/questions/34416869/idiomatic-way-
>>>>>> of-logging-in-kotlin>.
>>>>>>
>>>>>> I'm not familiar enough with any of the languages to really make good
>>>>>> recommendations yet, but I think it might be worthwhile to start
>>>>>> documenting support in other JVM languages. What do you guys think?
>>>>>>
>>>>>> --
>>>>>> Matt Sicker <bo...@gmail.com>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> [image: MagineTV]
>>>>>
>>>>> *Mikael Ståldal*
>>>>> Senior software developer
>>>>>
>>>>> *Magine TV*
>>>>> mikael.staldal@magine.com
>>>>> Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com
>>>>>
>>>>> Privileged and/or Confidential Information may be contained in this
>>>>> message. If you are not the addressee indicated in this message
>>>>> (or responsible for delivery of the message to such a person), you may
>>>>> not copy or deliver this message to anyone. In such case,
>>>>> you should destroy this message and kindly notify the sender by reply
>>>>> email.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Matt Sicker <bo...@gmail.com>
>>>>
>>>
>>>
>>>
>>> --
>>> [image: MagineTV]
>>>
>>> *Mikael Ståldal*
>>> Senior software developer
>>>
>>> *Magine TV*
>>> mikael.staldal@magine.com
>>> Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com
>>>
>>> Privileged and/or Confidential Information may be contained in this
>>> message. If you are not the addressee indicated in this message
>>> (or responsible for delivery of the message to such a person), you may
>>> not copy or deliver this message to anyone. In such case,
>>> you should destroy this message and kindly notify the sender by reply
>>> email.
>>>
>>
>>
>>
>> --
>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>> Java Persistence with Hibernate, Second Edition
>> <http://www.manning.com/bauer3/>
>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>> Spring Batch in Action <http://www.manning.com/templier/>
>> Blog: http://garygregory.wordpress.com
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory
>>
>
>
>
> --
> Matt Sicker <bo...@gmail.com>
>



-- 
[image: MagineTV]

*Mikael Ståldal*
Senior software developer

*Magine TV*
mikael.staldal@magine.com
Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com

Privileged and/or Confidential Information may be contained in this
message. If you are not the addressee indicated in this message
(or responsible for delivery of the message to such a person), you may not
copy or deliver this message to anyone. In such case,
you should destroy this message and kindly notify the sender by reply
email.

Re: With the upcoming Scala support, shall we start investigating general polyglot support?

Posted by Matt Sicker <bo...@gmail.com>.
Oh, I almost forgot, there's a terrible way to abuse Groovy that causes
performance problems, and I found this out by accident once:

import static org.apache.logging.log4j.LogManager.logger

def foo() {
    logger.debug("Hello, world!")
}

This calls LogManager.getLogger() for every use of "logger", and that
doesn't do any caching of the calling class (how would it?), so that turned
out to be a terrible idea. It was pretty cool, though, until Groovy added
the @Log4j2 annotation natively.

On 31 August 2016 at 21:32, Matt Sicker <bo...@gmail.com> wrote:

> The amount of support code Lombok has to abuse the annotation processor
> the way it does makes it seem like it should remain outside log4j. The lack
> of a need for Groovy-specific code is because Groovy is very similar to
> Java. Even without the annotations, you could do something like:
>
> class Foo {
>     static Logger log = LogManager.logger
>     // ...
> }
>
> A small list of JVM languages that may be worth documenting or providing
> small compatibility modules for are:
>
> * Scala (already completed)
> * Clojure
> * Kotlin
> * Ceylon
> * JRuby
> * Jython
> * JavaScript (Rhino or Nashorn)
>
> I know there are more JVM languages out there, but those cover the main
> production ones I've ever seen. Vert.x is a good example of a Java
> framework that supports most of those languages in idiomatic ways.
>
> On 31 August 2016 at 10:45, Gary Gregory <ga...@gmail.com> wrote:
>
>> I like the idea of Lombok and doing more with annotations and having to
>> write less code as a user.
>>
>> Gary
>>
>> On Wed, Aug 31, 2016 at 8:03 AM, Mikael Ståldal <
>> mikael.staldal@magine.com> wrote:
>>
>>> Then we probably not have to do anything for Groovy. But maybe for
>>> Kotlin.
>>>
>>> Another language to consider would be Clojure.
>>>
>>> On Wed, Aug 31, 2016 at 4:54 PM, Matt Sicker <bo...@gmail.com> wrote:
>>>
>>>> I know Groovy already has a built-in feature that makes using Log4j 2
>>>> easier:
>>>>
>>>> http://docs.groovy-lang.org/latest/html/gapi/groovy/util/log
>>>> ging/Log4j2.html
>>>>
>>>> And that's pretty similar to the Lombok feature:
>>>>
>>>> https://projectlombok.org/features/Log.html
>>>>
>>>> On 31 August 2016 at 03:36, Mikael Ståldal <mi...@magine.com>
>>>> wrote:
>>>>
>>>>> Could make sense. Otherwise people will probably create and use
>>>>> libraries like https://github.com/MicroUtils/kotlin-logging which
>>>>> links to SLF4J.
>>>>>
>>>>> On Tue, Aug 30, 2016 at 8:21 PM, Matt Sicker <bo...@gmail.com> wrote:
>>>>>
>>>>>> I'm currently interesting in a few JVM languages, and besides Groovy,
>>>>>> each language seems to have their own idiomatic ways of handling things
>>>>>> that are just slightly different enough from Java to either warrant a
>>>>>> separate module (like the Scala one) or at least documenting how to use it
>>>>>> in such a language. For instance, some details on using Log4j in Kotlin: <
>>>>>> https://stackoverflow.com/questions/34416869/idiomatic-way-
>>>>>> of-logging-in-kotlin>.
>>>>>>
>>>>>> I'm not familiar enough with any of the languages to really make good
>>>>>> recommendations yet, but I think it might be worthwhile to start
>>>>>> documenting support in other JVM languages. What do you guys think?
>>>>>>
>>>>>> --
>>>>>> Matt Sicker <bo...@gmail.com>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> [image: MagineTV]
>>>>>
>>>>> *Mikael Ståldal*
>>>>> Senior software developer
>>>>>
>>>>> *Magine TV*
>>>>> mikael.staldal@magine.com
>>>>> Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com
>>>>>
>>>>> Privileged and/or Confidential Information may be contained in this
>>>>> message. If you are not the addressee indicated in this message
>>>>> (or responsible for delivery of the message to such a person), you may
>>>>> not copy or deliver this message to anyone. In such case,
>>>>> you should destroy this message and kindly notify the sender by reply
>>>>> email.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Matt Sicker <bo...@gmail.com>
>>>>
>>>
>>>
>>>
>>> --
>>> [image: MagineTV]
>>>
>>> *Mikael Ståldal*
>>> Senior software developer
>>>
>>> *Magine TV*
>>> mikael.staldal@magine.com
>>> Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com
>>>
>>> Privileged and/or Confidential Information may be contained in this
>>> message. If you are not the addressee indicated in this message
>>> (or responsible for delivery of the message to such a person), you may
>>> not copy or deliver this message to anyone. In such case,
>>> you should destroy this message and kindly notify the sender by reply
>>> email.
>>>
>>
>>
>>
>> --
>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>> Java Persistence with Hibernate, Second Edition
>> <http://www.manning.com/bauer3/>
>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>> Spring Batch in Action <http://www.manning.com/templier/>
>> Blog: http://garygregory.wordpress.com
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory
>>
>
>
>
> --
> Matt Sicker <bo...@gmail.com>
>



-- 
Matt Sicker <bo...@gmail.com>