You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@logging.apache.org by Matt Sicker <bo...@gmail.com> on 2017/11/11 01:59:16 UTC

Re: logging-log4j2 git commit: [LOG4J2-2114] Provide a native Log4j 2 implementation of Eclipse Jetty's org.eclipse.jetty.util.log.Logger.

Wouldn't this implementation contain incorrect caller location information?

On 10 November 2017 at 19:25, <gg...@apache.org> wrote:

> Repository: logging-log4j2
> Updated Branches:
>   refs/heads/master aad2f132b -> 7d52f131e
>
>
> [LOG4J2-2114] Provide a native Log4j 2 implementation of Eclipse Jetty's
> org.eclipse.jetty.util.log.Logger.
>
> Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
> Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/
> commit/7d52f131
> Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/7d52f131
> Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/7d52f131
>
> Branch: refs/heads/master
> Commit: 7d52f131ec1e000834bcb40343f3f2d41805c75a
> Parents: aad2f13
> Author: Gary Gregory <gg...@apache.org>
> Authored: Fri Nov 10 18:25:47 2017 -0700
> Committer: Gary Gregory <gg...@apache.org>
> Committed: Fri Nov 10 18:25:47 2017 -0700
>
> ----------------------------------------------------------------------
>  log4j-appserver/pom.xml                         |   8 +
>  .../log4j/appserver/jetty/Log4j2Logger.java     | 184 +++++++++++++++++++
>  src/changes/changes.xml                         |   3 +
>  3 files changed, 195 insertions(+)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> 7d52f131/log4j-appserver/pom.xml
> ----------------------------------------------------------------------
> diff --git a/log4j-appserver/pom.xml b/log4j-appserver/pom.xml
> index e96b1fc..6acd77b 100644
> --- a/log4j-appserver/pom.xml
> +++ b/log4j-appserver/pom.xml
> @@ -34,6 +34,7 @@
>      <docLabel>Web Documentation</docLabel>
>      <projectDir>/log4j-appserver</projectDir>
>      <tomcat.version>8.5.20</tomcat.version>
> +    <jetty.version>8.2.0.v20160908</jetty.version> <!--  Jetty 9
> requires Java 8 -->
>      <module.name>org.apache.logging.log4j.appserver</module.name>
>    </properties>
>
> @@ -56,6 +57,7 @@
>        <groupId>org.apache.tomcat</groupId>
>        <artifactId>tomcat-catalina</artifactId>
>        <version>${tomcat.version}</version>
> +      <scope>provided</scope>
>        <exclusions>
>          <exclusion>
>            <groupId>org.apache.tomcat</groupId>
> @@ -71,6 +73,12 @@
>          </exclusion>
>        </exclusions>
>      </dependency>
> +    <dependency>
> +      <groupId>org.eclipse.jetty</groupId>
> +      <artifactId>jetty-util</artifactId>
> +      <version>${jetty.version}</version>
> +      <scope>provided</scope>
> +    </dependency>
>
>      <!-- Test dependencies -->
>      <dependency>
>
> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> 7d52f131/log4j-appserver/src/main/java/org/apache/logging/
> log4j/appserver/jetty/Log4j2Logger.java
> ----------------------------------------------------------------------
> diff --git a/log4j-appserver/src/main/java/org/apache/logging/log4j/
> appserver/jetty/Log4j2Logger.java b/log4j-appserver/src/main/
> java/org/apache/logging/log4j/appserver/jetty/Log4j2Logger.java
> new file mode 100644
> index 0000000..7d1ce14
> --- /dev/null
> +++ b/log4j-appserver/src/main/java/org/apache/logging/log4j/
> appserver/jetty/Log4j2Logger.java
> @@ -0,0 +1,184 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one or more
> + * contributor license agreements. See the NOTICE file distributed with
> + * this work for additional information regarding copyright ownership.
> + * The ASF licenses this file to You under the Apache license, Version 2.0
> + * (the "License"); you may not use this file except in compliance with
> + * the License. You may obtain a copy of the License at
> + *
> + *      http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> + * See the license for the specific language governing permissions and
> + * limitations under the license.
> + */
> +
> +package org.apache.logging.log4j.appserver.jetty;
> +
> +import org.apache.logging.log4j.LogManager;
> +import org.eclipse.jetty.util.log.AbstractLogger;
> +import org.eclipse.jetty.util.log.Logger;
> +
> +/**
> + * Provides a native Apache Log4j 2 for Jetty logging.
> + */
> +public class Log4j2Logger extends AbstractLogger {
> +
> +    private final org.apache.logging.log4j.Logger logger;
> +
> +    private final String name;
> +
> +    public Log4j2Logger(final String name) {
> +        super();
> +        this.name = name;
> +        this.logger = LogManager.getLogger(name);
> +    }
> +
> +    public Log4j2Logger() {
> +        this("");
> +    }
> +
> +    /*
> +     * (non-Javadoc)
> +     *
> +     * @see org.eclipse.jetty.util.log.Logger#debug(java.lang.String,
> java.lang.Object[])
> +     */
> +    @Override
> +    public void debug(final String msg, final Object... args) {
> +        logger.debug(msg, args);
> +    }
> +
> +    /*
> +     * (non-Javadoc)
> +     *
> +     * @see org.eclipse.jetty.util.log.Logger#debug(java.lang.String,
> java.lang.Throwable)
> +     */
> +    @Override
> +    public void debug(final String msg, final Throwable thrown) {
> +        logger.debug(msg, thrown);
> +    }
> +
> +    /*
> +     * (non-Javadoc)
> +     *
> +     * @see org.eclipse.jetty.util.log.Logger#debug(java.lang.Throwable)
> +     */
> +    @Override
> +    public void debug(final Throwable thrown) {
> +        logger.debug(thrown);
> +    }
> +
> +    /*
> +     * (non-Javadoc)
> +     *
> +     * @see org.eclipse.jetty.util.log.Logger#getName()
> +     */
> +    @Override
> +    public String getName() {
> +        return name;
> +    }
> +
> +    /*
> +     * (non-Javadoc)
> +     *
> +     * @see org.eclipse.jetty.util.log.Logger#ignore(java.lang.Throwable)
> +     */
> +    @Override
> +    public void ignore(final Throwable ignored) {
> +        // TODO Auto-generated method stub
> +
> +    }
> +
> +    /*
> +     * (non-Javadoc)
> +     *
> +     * @see org.eclipse.jetty.util.log.Logger#info(java.lang.String,
> java.lang.Object[])
> +     */
> +    @Override
> +    public void info(final String msg, final Object... args) {
> +        logger.info(msg, args);
> +    }
> +
> +    /*
> +     * (non-Javadoc)
> +     *
> +     * @see org.eclipse.jetty.util.log.Logger#info(java.lang.String,
> java.lang.Throwable)
> +     */
> +    @Override
> +    public void info(final String msg, final Throwable thrown) {
> +        logger.info(msg, thrown);
> +    }
> +
> +    /*
> +     * (non-Javadoc)
> +     *
> +     * @see org.eclipse.jetty.util.log.Logger#info(java.lang.Throwable)
> +     */
> +    @Override
> +    public void info(final Throwable thrown) {
> +        logger.info(thrown);
> +    }
> +
> +    /*
> +     * (non-Javadoc)
> +     *
> +     * @see org.eclipse.jetty.util.log.Logger#isDebugEnabled()
> +     */
> +    @Override
> +    public boolean isDebugEnabled() {
> +        return logger.isDebugEnabled();
> +    }
> +
> +    /*
> +     * (non-Javadoc)
> +     *
> +     * @see org.eclipse.jetty.util.log.AbstractLogger#newLogger(java.
> lang.String)
> +     */
> +    @Override
> +    protected Logger newLogger(final String fullname) {
> +        return new Log4j2Logger(fullname);
> +    }
> +
> +    /*
> +     * (non-Javadoc)
> +     *
> +     * @see org.eclipse.jetty.util.log.Logger#setDebugEnabled(boolean)
> +     */
> +    @Override
> +    public void setDebugEnabled(final boolean enabled) {
> +        warn("setDebugEnabled not implemented");
> +    }
> +
> +    /*
> +     * (non-Javadoc)
> +     *
> +     * @see org.eclipse.jetty.util.log.Logger#warn(java.lang.String,
> java.lang.Object[])
> +     */
> +    @Override
> +    public void warn(final String msg, final Object... args) {
> +        logger.warn(msg, args);
> +    }
> +
> +    /*
> +     * (non-Javadoc)
> +     *
> +     * @see org.eclipse.jetty.util.log.Logger#warn(java.lang.String,
> java.lang.Throwable)
> +     */
> +    @Override
> +    public void warn(final String msg, final Throwable thrown) {
> +        logger.warn(msg, thrown);
> +    }
> +
> +    /*
> +     * (non-Javadoc)
> +     *
> +     * @see org.eclipse.jetty.util.log.Logger#warn(java.lang.Throwable)
> +     */
> +    @Override
> +    public void warn(final Throwable thrown) {
> +        logger.warn(thrown);
> +    }
> +
> +}
>
> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> 7d52f131/src/changes/changes.xml
> ----------------------------------------------------------------------
> diff --git a/src/changes/changes.xml b/src/changes/changes.xml
> index 2bcefb2..070e4a1 100644
> --- a/src/changes/changes.xml
> +++ b/src/changes/changes.xml
> @@ -37,6 +37,9 @@
>        <action issue="LOG4J2-2103" dev="mikes" type="add">
>          XML encoding for PatternLayout.
>        </action>
> +      <action issue="LOG4J2-2114" dev="ggregory" type="add">
> +        Provide a native Log4j 2 implementation of Eclipse Jetty's
> org.eclipse.jetty.util.log.Logger.
> +      </action>
>        <action issue="LOG4J2-1203" dev="mikes" type="add" due-to="Robert
> Turner">
>          Allow filtering of line breaks in layout pattern.
>        </action>
>
>


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

Re: logging-log4j2 git commit: [LOG4J2-2114] Provide a native Log4j 2 implementation of Eclipse Jetty's org.eclipse.jetty.util.log.Logger.

Posted by Gary Gregory <ga...@gmail.com>.
In org.apache.logging.log4j.appserver.jetty.Log4j2Logger.PrivateManager.getContext():

Is this just a matter of changing false to true in:

        public static LoggerContext getContext() {
            final ClassLoader cl = Log4j2Logger.class.getClassLoader();
            return getContext(FQCN, cl, false);
        }

Or is the method supposed to dig up a class loader from a application class
on the stack?

?

Gary

On Mon, Nov 13, 2017 at 9:21 AM, Gary Gregory <ga...@gmail.com>
wrote:

> I will take a look...
>
> On Nov 13, 2017 08:43, "Ralph Goers" <ra...@dslextreme.com> wrote:
>
>> Are you planning on fixing this?
>>
>> Ralph
>>
>> > On Nov 11, 2017, at 5:15 PM, Ralph Goers <ra...@dslextreme.com>
>> wrote:
>> >
>> > Because the caller of newLogger(name) is AbstractLogger its ClassLoader
>> will always be used. You need the ClassLoader of the caller of getLogger().
>> >
>> > Ralph
>> >
>> >> On Nov 11, 2017, at 3:43 PM, Gary Gregory <ga...@gmail.com>
>> wrote:
>> >>
>> >> Please code review git master. I'm not sure I have the class loader
>> right.
>> >>
>> >> Gary
>> >>
>> >> On Sat, Nov 11, 2017 at 2:54 PM, Ralph Goers <
>> ralph.goers@dslextreme.com>
>> >> wrote:
>> >>
>> >>> Oh, but you probably don’t want to extend AbstractLogger. You really
>> want
>> >>> the FQCN of the caller to be able to identify the ClassLoader and
>> >>> LoggerContext to use and you won’t get that from AbstractLogger’s
>> getLogger
>> >>> method.
>> >>>
>> >>> Ralph
>> >>>
>> >>>> On Nov 11, 2017, at 2:45 PM, Ralph Goers <ralph.goers@dslextreme.com
>> >
>> >>> wrote:
>> >>>>
>> >>>> Sure. Look at TomcatLogger. It does exactly what you are trying to
>> do.
>> >>>>
>> >>>> Ralph
>> >>>>
>> >>>>> On Nov 11, 2017, at 2:02 PM, Gary Gregory <ga...@gmail.com>
>> >>> wrote:
>> >>>>>
>> >>>>> The Javadoc for Log4j's LoggerAdapter says "This registry should
>> not be
>> >>>>> used for Log4j Loggers; it is instead used for creating bridges to
>> other
>> >>>>> external log systems.".
>> >>>>>
>> >>>>> In this case we are not bridging TO another log system. We are
>> plugging
>> >>>>> INTO Jetty's log system and subclassing Jetty's own LoggerAdapter
>> class
>> >>>>> (out convenience.)
>> >>>>>
>> >>>>> Further thoughts?
>> >>>>>
>> >>>>> Gary
>> >>>>>
>> >>>>> On Fri, Nov 10, 2017 at 9:25 PM, Matt Sicker <bo...@gmail.com>
>> wrote:
>> >>>>>
>> >>>>>> IIRC, the easiest way to support it might be to use
>> >>>>>> https://logging.apache.org/log4j/2.x/log4j-api/apidocs/
>> >>>>>> org/apache/logging/log4j/spi/AbstractLoggerAdapter.html
>> >>>>>>
>> >>>>>> On 10 November 2017 at 22:16, Gary Gregory <garydgregory@gmail.com
>> >
>> >>> wrote:
>> >>>>>>
>> >>>>>>> I think you are correct...
>> >>>>>>>
>> >>>>>>> Gary
>> >>>>>>>
>> >>>>>>> On Fri, Nov 10, 2017 at 6:59 PM, Matt Sicker <bo...@gmail.com>
>> >>> wrote:
>> >>>>>>>
>> >>>>>>>> Wouldn't this implementation contain incorrect caller location
>> >>>>>>> information?
>> >>>>>>>>
>> >>>>>>>> On 10 November 2017 at 19:25, <gg...@apache.org> wrote:
>> >>>>>>>>
>> >>>>>>>>> Repository: logging-log4j2
>> >>>>>>>>> Updated Branches:
>> >>>>>>>>> refs/heads/master aad2f132b -> 7d52f131e
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>> [LOG4J2-2114] Provide a native Log4j 2 implementation of Eclipse
>> >>>>>>> Jetty's
>> >>>>>>>>> org.eclipse.jetty.util.log.Logger.
>> >>>>>>>>>
>> >>>>>>>>> Project: http://git-wip-us.apache.org/r
>> epos/asf/logging-log4j2/repo
>> >>>>>>>>> Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/
>> >>>>>>>>> commit/7d52f131
>> >>>>>>>>> Tree: http://git-wip-us.apache.org/r
>> epos/asf/logging-log4j2/tree/
>> >>>>>>>> 7d52f131
>> >>>>>>>>> Diff: http://git-wip-us.apache.org/r
>> epos/asf/logging-log4j2/diff/
>> >>>>>>>> 7d52f131
>> >>>>>>>>>
>> >>>>>>>>> Branch: refs/heads/master
>> >>>>>>>>> Commit: 7d52f131ec1e000834bcb40343f3f2d41805c75a
>> >>>>>>>>> Parents: aad2f13
>> >>>>>>>>> Author: Gary Gregory <gg...@apache.org>
>> >>>>>>>>> Authored: Fri Nov 10 18:25:47 2017 -0700
>> >>>>>>>>> Committer: Gary Gregory <gg...@apache.org>
>> >>>>>>>>> Committed: Fri Nov 10 18:25:47 2017 -0700
>> >>>>>>>>>
>> >>>>>>>>> ------------------------------------------------------------
>> >>>>>> ----------
>> >>>>>>>>> log4j-appserver/pom.xml                         |   8 +
>> >>>>>>>>> .../log4j/appserver/jetty/Log4j2Logger.java     | 184
>> >>>>>>>> +++++++++++++++++++
>> >>>>>>>>> src/changes/changes.xml                         |   3 +
>> >>>>>>>>> 3 files changed, 195 insertions(+)
>> >>>>>>>>> ------------------------------------------------------------
>> >>>>>> ----------
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
>> >>>>>>>>> 7d52f131/log4j-appserver/pom.xml
>> >>>>>>>>> ------------------------------------------------------------
>> >>>>>> ----------
>> >>>>>>>>> diff --git a/log4j-appserver/pom.xml b/log4j-appserver/pom.xml
>> >>>>>>>>> index e96b1fc..6acd77b 100644
>> >>>>>>>>> --- a/log4j-appserver/pom.xml
>> >>>>>>>>> +++ b/log4j-appserver/pom.xml
>> >>>>>>>>> @@ -34,6 +34,7 @@
>> >>>>>>>>>  <docLabel>Web Documentation</docLabel>
>> >>>>>>>>>  <projectDir>/log4j-appserver</projectDir>
>> >>>>>>>>>  <tomcat.version>8.5.20</tomcat.version>
>> >>>>>>>>> +    <jetty.version>8.2.0.v20160908</jetty.version> <!--
>> Jetty 9
>> >>>>>>>>> requires Java 8 -->
>> >>>>>>>>>  <module.name>org.apache.logging.log4j.appserver</module.name>
>> >>>>>>>>> </properties>
>> >>>>>>>>>
>> >>>>>>>>> @@ -56,6 +57,7 @@
>> >>>>>>>>>    <groupId>org.apache.tomcat</groupId>
>> >>>>>>>>>    <artifactId>tomcat-catalina</artifactId>
>> >>>>>>>>>    <version>${tomcat.version}</version>
>> >>>>>>>>> +      <scope>provided</scope>
>> >>>>>>>>>    <exclusions>
>> >>>>>>>>>      <exclusion>
>> >>>>>>>>>        <groupId>org.apache.tomcat</groupId>
>> >>>>>>>>> @@ -71,6 +73,12 @@
>> >>>>>>>>>      </exclusion>
>> >>>>>>>>>    </exclusions>
>> >>>>>>>>>  </dependency>
>> >>>>>>>>> +    <dependency>
>> >>>>>>>>> +      <groupId>org.eclipse.jetty</groupId>
>> >>>>>>>>> +      <artifactId>jetty-util</artifactId>
>> >>>>>>>>> +      <version>${jetty.version}</version>
>> >>>>>>>>> +      <scope>provided</scope>
>> >>>>>>>>> +    </dependency>
>> >>>>>>>>>
>> >>>>>>>>>  <!-- Test dependencies -->
>> >>>>>>>>>  <dependency>
>> >>>>>>>>>
>> >>>>>>>>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
>> >>>>>>>>> 7d52f131/log4j-appserver/src/main/java/org/apache/logging/
>> >>>>>>>>> log4j/appserver/jetty/Log4j2Logger.java
>> >>>>>>>>> ------------------------------------------------------------
>> >>>>>> ----------
>> >>>>>>>>> diff --git a/log4j-appserver/src/main/
>> >>> java/org/apache/logging/log4j/
>> >>>>>>>>> appserver/jetty/Log4j2Logger.java b/log4j-appserver/src/main/
>> >>>>>>>>> java/org/apache/logging/log4j/appserver/jetty/Log4j2Logger.java
>> >>>>>>>>> new file mode 100644
>> >>>>>>>>> index 0000000..7d1ce14
>> >>>>>>>>> --- /dev/null
>> >>>>>>>>> +++ b/log4j-appserver/src/main/java/org/apache/logging/log4j/
>> >>>>>>>>> appserver/jetty/Log4j2Logger.java
>> >>>>>>>>> @@ -0,0 +1,184 @@
>> >>>>>>>>> +/*
>> >>>>>>>>> + * Licensed to the Apache Software Foundation (ASF) under one
>> or
>> >>>>>> more
>> >>>>>>>>> + * contributor license agreements. See the NOTICE file
>> distributed
>> >>>>>>> with
>> >>>>>>>>> + * this work for additional information regarding copyright
>> >>>>>> ownership.
>> >>>>>>>>> + * The ASF licenses this file to You under the Apache license,
>> >>>>>> Version
>> >>>>>>>> 2.0
>> >>>>>>>>> + * (the "License"); you may not use this file except in
>> compliance
>> >>>>>>> with
>> >>>>>>>>> + * the License. You may obtain a copy of the License at
>> >>>>>>>>> + *
>> >>>>>>>>> + *      http://www.apache.org/licenses/LICENSE-2.0
>> >>>>>>>>> + *
>> >>>>>>>>> + * Unless required by applicable law or agreed to in writing,
>> >>>>>> software
>> >>>>>>>>> + * distributed under the License is distributed on an "AS IS"
>> >>> BASIS,
>> >>>>>>>>> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
>> express or
>> >>>>>>>>> implied.
>> >>>>>>>>> + * See the license for the specific language governing
>> permissions
>> >>>>>> and
>> >>>>>>>>> + * limitations under the license.
>> >>>>>>>>> + */
>> >>>>>>>>> +
>> >>>>>>>>> +package org.apache.logging.log4j.appserver.jetty;
>> >>>>>>>>> +
>> >>>>>>>>> +import org.apache.logging.log4j.LogManager;
>> >>>>>>>>> +import org.eclipse.jetty.util.log.AbstractLogger;
>> >>>>>>>>> +import org.eclipse.jetty.util.log.Logger;
>> >>>>>>>>> +
>> >>>>>>>>> +/**
>> >>>>>>>>> + * Provides a native Apache Log4j 2 for Jetty logging.
>> >>>>>>>>> + */
>> >>>>>>>>> +public class Log4j2Logger extends AbstractLogger {
>> >>>>>>>>> +
>> >>>>>>>>> +    private final org.apache.logging.log4j.Logger logger;
>> >>>>>>>>> +
>> >>>>>>>>> +    private final String name;
>> >>>>>>>>> +
>> >>>>>>>>> +    public Log4j2Logger(final String name) {
>> >>>>>>>>> +        super();
>> >>>>>>>>> +        this.name = name;
>> >>>>>>>>> +        this.logger = LogManager.getLogger(name);
>> >>>>>>>>> +    }
>> >>>>>>>>> +
>> >>>>>>>>> +    public Log4j2Logger() {
>> >>>>>>>>> +        this("");
>> >>>>>>>>> +    }
>> >>>>>>>>> +
>> >>>>>>>>> +    /*
>> >>>>>>>>> +     * (non-Javadoc)
>> >>>>>>>>> +     *
>> >>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>> >>>>>> Logger#debug(java.lang.String,
>> >>>>>>>>> java.lang.Object[])
>> >>>>>>>>> +     */
>> >>>>>>>>> +    @Override
>> >>>>>>>>> +    public void debug(final String msg, final Object... args) {
>> >>>>>>>>> +        logger.debug(msg, args);
>> >>>>>>>>> +    }
>> >>>>>>>>> +
>> >>>>>>>>> +    /*
>> >>>>>>>>> +     * (non-Javadoc)
>> >>>>>>>>> +     *
>> >>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>> >>>>>> Logger#debug(java.lang.String,
>> >>>>>>>>> java.lang.Throwable)
>> >>>>>>>>> +     */
>> >>>>>>>>> +    @Override
>> >>>>>>>>> +    public void debug(final String msg, final Throwable
>> thrown) {
>> >>>>>>>>> +        logger.debug(msg, thrown);
>> >>>>>>>>> +    }
>> >>>>>>>>> +
>> >>>>>>>>> +    /*
>> >>>>>>>>> +     * (non-Javadoc)
>> >>>>>>>>> +     *
>> >>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#debug(java.lang.
>> >>>>>>>> Throwable)
>> >>>>>>>>> +     */
>> >>>>>>>>> +    @Override
>> >>>>>>>>> +    public void debug(final Throwable thrown) {
>> >>>>>>>>> +        logger.debug(thrown);
>> >>>>>>>>> +    }
>> >>>>>>>>> +
>> >>>>>>>>> +    /*
>> >>>>>>>>> +     * (non-Javadoc)
>> >>>>>>>>> +     *
>> >>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#getName()
>> >>>>>>>>> +     */
>> >>>>>>>>> +    @Override
>> >>>>>>>>> +    public String getName() {
>> >>>>>>>>> +        return name;
>> >>>>>>>>> +    }
>> >>>>>>>>> +
>> >>>>>>>>> +    /*
>> >>>>>>>>> +     * (non-Javadoc)
>> >>>>>>>>> +     *
>> >>>>>>>>> +     * @see org.eclipse.jetty.util.log.Log
>> ger#ignore(java.lang.
>> >>>>>>>> Throwable)
>> >>>>>>>>> +     */
>> >>>>>>>>> +    @Override
>> >>>>>>>>> +    public void ignore(final Throwable ignored) {
>> >>>>>>>>> +        // TODO Auto-generated method stub
>> >>>>>>>>> +
>> >>>>>>>>> +    }
>> >>>>>>>>> +
>> >>>>>>>>> +    /*
>> >>>>>>>>> +     * (non-Javadoc)
>> >>>>>>>>> +     *
>> >>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>> >>>>>> Logger#info(java.lang.String,
>> >>>>>>>>> java.lang.Object[])
>> >>>>>>>>> +     */
>> >>>>>>>>> +    @Override
>> >>>>>>>>> +    public void info(final String msg, final Object... args) {
>> >>>>>>>>> +        logger.info(msg, args);
>> >>>>>>>>> +    }
>> >>>>>>>>> +
>> >>>>>>>>> +    /*
>> >>>>>>>>> +     * (non-Javadoc)
>> >>>>>>>>> +     *
>> >>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>> >>>>>> Logger#info(java.lang.String,
>> >>>>>>>>> java.lang.Throwable)
>> >>>>>>>>> +     */
>> >>>>>>>>> +    @Override
>> >>>>>>>>> +    public void info(final String msg, final Throwable thrown)
>> {
>> >>>>>>>>> +        logger.info(msg, thrown);
>> >>>>>>>>> +    }
>> >>>>>>>>> +
>> >>>>>>>>> +    /*
>> >>>>>>>>> +     * (non-Javadoc)
>> >>>>>>>>> +     *
>> >>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#info(java.lang.
>> >>>>>>> Throwable)
>> >>>>>>>>> +     */
>> >>>>>>>>> +    @Override
>> >>>>>>>>> +    public void info(final Throwable thrown) {
>> >>>>>>>>> +        logger.info(thrown);
>> >>>>>>>>> +    }
>> >>>>>>>>> +
>> >>>>>>>>> +    /*
>> >>>>>>>>> +     * (non-Javadoc)
>> >>>>>>>>> +     *
>> >>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#isDebugEnabled()
>> >>>>>>>>> +     */
>> >>>>>>>>> +    @Override
>> >>>>>>>>> +    public boolean isDebugEnabled() {
>> >>>>>>>>> +        return logger.isDebugEnabled();
>> >>>>>>>>> +    }
>> >>>>>>>>> +
>> >>>>>>>>> +    /*
>> >>>>>>>>> +     * (non-Javadoc)
>> >>>>>>>>> +     *
>> >>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>> >>>>>> AbstractLogger#newLogger(java.
>> >>>>>>>>> lang.String)
>> >>>>>>>>> +     */
>> >>>>>>>>> +    @Override
>> >>>>>>>>> +    protected Logger newLogger(final String fullname) {
>> >>>>>>>>> +        return new Log4j2Logger(fullname);
>> >>>>>>>>> +    }
>> >>>>>>>>> +
>> >>>>>>>>> +    /*
>> >>>>>>>>> +     * (non-Javadoc)
>> >>>>>>>>> +     *
>> >>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#setDebugEnabled(
>> >>>>>>> boolean)
>> >>>>>>>>> +     */
>> >>>>>>>>> +    @Override
>> >>>>>>>>> +    public void setDebugEnabled(final boolean enabled) {
>> >>>>>>>>> +        warn("setDebugEnabled not implemented");
>> >>>>>>>>> +    }
>> >>>>>>>>> +
>> >>>>>>>>> +    /*
>> >>>>>>>>> +     * (non-Javadoc)
>> >>>>>>>>> +     *
>> >>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>> >>>>>> Logger#warn(java.lang.String,
>> >>>>>>>>> java.lang.Object[])
>> >>>>>>>>> +     */
>> >>>>>>>>> +    @Override
>> >>>>>>>>> +    public void warn(final String msg, final Object... args) {
>> >>>>>>>>> +        logger.warn(msg, args);
>> >>>>>>>>> +    }
>> >>>>>>>>> +
>> >>>>>>>>> +    /*
>> >>>>>>>>> +     * (non-Javadoc)
>> >>>>>>>>> +     *
>> >>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>> >>>>>> Logger#warn(java.lang.String,
>> >>>>>>>>> java.lang.Throwable)
>> >>>>>>>>> +     */
>> >>>>>>>>> +    @Override
>> >>>>>>>>> +    public void warn(final String msg, final Throwable thrown)
>> {
>> >>>>>>>>> +        logger.warn(msg, thrown);
>> >>>>>>>>> +    }
>> >>>>>>>>> +
>> >>>>>>>>> +    /*
>> >>>>>>>>> +     * (non-Javadoc)
>> >>>>>>>>> +     *
>> >>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#warn(java.lang.
>> >>>>>>> Throwable)
>> >>>>>>>>> +     */
>> >>>>>>>>> +    @Override
>> >>>>>>>>> +    public void warn(final Throwable thrown) {
>> >>>>>>>>> +        logger.warn(thrown);
>> >>>>>>>>> +    }
>> >>>>>>>>> +
>> >>>>>>>>> +}
>> >>>>>>>>>
>> >>>>>>>>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
>> >>>>>>>>> 7d52f131/src/changes/changes.xml
>> >>>>>>>>> ------------------------------------------------------------
>> >>>>>> ----------
>> >>>>>>>>> diff --git a/src/changes/changes.xml b/src/changes/changes.xml
>> >>>>>>>>> index 2bcefb2..070e4a1 100644
>> >>>>>>>>> --- a/src/changes/changes.xml
>> >>>>>>>>> +++ b/src/changes/changes.xml
>> >>>>>>>>> @@ -37,6 +37,9 @@
>> >>>>>>>>>    <action issue="LOG4J2-2103" dev="mikes" type="add">
>> >>>>>>>>>      XML encoding for PatternLayout.
>> >>>>>>>>>    </action>
>> >>>>>>>>> +      <action issue="LOG4J2-2114" dev="ggregory" type="add">
>> >>>>>>>>> +        Provide a native Log4j 2 implementation of Eclipse
>> Jetty's
>> >>>>>>>>> org.eclipse.jetty.util.log.Logger.
>> >>>>>>>>> +      </action>
>> >>>>>>>>>    <action issue="LOG4J2-1203" dev="mikes" type="add"
>> >>>>>>> due-to="Robert
>> >>>>>>>>> Turner">
>> >>>>>>>>>      Allow filtering of line breaks in layout pattern.
>> >>>>>>>>>    </action>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>> --
>> >>>>>>>> Matt Sicker <bo...@gmail.com>
>> >>>>>>>>
>> >>>>>>>
>> >>>>>>
>> >>>>>>
>> >>>>>>
>> >>>>>> --
>> >>>>>> Matt Sicker <bo...@gmail.com>
>> >>>>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>
>> >>>
>> >>>
>> >
>> >
>> >
>>
>>
>>

Re: logging-log4j2 git commit: [LOG4J2-2114] Provide a native Log4j 2 implementation of Eclipse Jetty's org.eclipse.jetty.util.log.Logger.

Posted by Gary Gregory <ga...@gmail.com>.
I will take a look...

On Nov 13, 2017 08:43, "Ralph Goers" <ra...@dslextreme.com> wrote:

> Are you planning on fixing this?
>
> Ralph
>
> > On Nov 11, 2017, at 5:15 PM, Ralph Goers <ra...@dslextreme.com>
> wrote:
> >
> > Because the caller of newLogger(name) is AbstractLogger its ClassLoader
> will always be used. You need the ClassLoader of the caller of getLogger().
> >
> > Ralph
> >
> >> On Nov 11, 2017, at 3:43 PM, Gary Gregory <ga...@gmail.com>
> wrote:
> >>
> >> Please code review git master. I'm not sure I have the class loader
> right.
> >>
> >> Gary
> >>
> >> On Sat, Nov 11, 2017 at 2:54 PM, Ralph Goers <
> ralph.goers@dslextreme.com>
> >> wrote:
> >>
> >>> Oh, but you probably don’t want to extend AbstractLogger. You really
> want
> >>> the FQCN of the caller to be able to identify the ClassLoader and
> >>> LoggerContext to use and you won’t get that from AbstractLogger’s
> getLogger
> >>> method.
> >>>
> >>> Ralph
> >>>
> >>>> On Nov 11, 2017, at 2:45 PM, Ralph Goers <ra...@dslextreme.com>
> >>> wrote:
> >>>>
> >>>> Sure. Look at TomcatLogger. It does exactly what you are trying to do.
> >>>>
> >>>> Ralph
> >>>>
> >>>>> On Nov 11, 2017, at 2:02 PM, Gary Gregory <ga...@gmail.com>
> >>> wrote:
> >>>>>
> >>>>> The Javadoc for Log4j's LoggerAdapter says "This registry should not
> be
> >>>>> used for Log4j Loggers; it is instead used for creating bridges to
> other
> >>>>> external log systems.".
> >>>>>
> >>>>> In this case we are not bridging TO another log system. We are
> plugging
> >>>>> INTO Jetty's log system and subclassing Jetty's own LoggerAdapter
> class
> >>>>> (out convenience.)
> >>>>>
> >>>>> Further thoughts?
> >>>>>
> >>>>> Gary
> >>>>>
> >>>>> On Fri, Nov 10, 2017 at 9:25 PM, Matt Sicker <bo...@gmail.com>
> wrote:
> >>>>>
> >>>>>> IIRC, the easiest way to support it might be to use
> >>>>>> https://logging.apache.org/log4j/2.x/log4j-api/apidocs/
> >>>>>> org/apache/logging/log4j/spi/AbstractLoggerAdapter.html
> >>>>>>
> >>>>>> On 10 November 2017 at 22:16, Gary Gregory <ga...@gmail.com>
> >>> wrote:
> >>>>>>
> >>>>>>> I think you are correct...
> >>>>>>>
> >>>>>>> Gary
> >>>>>>>
> >>>>>>> On Fri, Nov 10, 2017 at 6:59 PM, Matt Sicker <bo...@gmail.com>
> >>> wrote:
> >>>>>>>
> >>>>>>>> Wouldn't this implementation contain incorrect caller location
> >>>>>>> information?
> >>>>>>>>
> >>>>>>>> On 10 November 2017 at 19:25, <gg...@apache.org> wrote:
> >>>>>>>>
> >>>>>>>>> Repository: logging-log4j2
> >>>>>>>>> Updated Branches:
> >>>>>>>>> refs/heads/master aad2f132b -> 7d52f131e
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> [LOG4J2-2114] Provide a native Log4j 2 implementation of Eclipse
> >>>>>>> Jetty's
> >>>>>>>>> org.eclipse.jetty.util.log.Logger.
> >>>>>>>>>
> >>>>>>>>> Project: http://git-wip-us.apache.org/
> repos/asf/logging-log4j2/repo
> >>>>>>>>> Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/
> >>>>>>>>> commit/7d52f131
> >>>>>>>>> Tree: http://git-wip-us.apache.org/
> repos/asf/logging-log4j2/tree/
> >>>>>>>> 7d52f131
> >>>>>>>>> Diff: http://git-wip-us.apache.org/
> repos/asf/logging-log4j2/diff/
> >>>>>>>> 7d52f131
> >>>>>>>>>
> >>>>>>>>> Branch: refs/heads/master
> >>>>>>>>> Commit: 7d52f131ec1e000834bcb40343f3f2d41805c75a
> >>>>>>>>> Parents: aad2f13
> >>>>>>>>> Author: Gary Gregory <gg...@apache.org>
> >>>>>>>>> Authored: Fri Nov 10 18:25:47 2017 -0700
> >>>>>>>>> Committer: Gary Gregory <gg...@apache.org>
> >>>>>>>>> Committed: Fri Nov 10 18:25:47 2017 -0700
> >>>>>>>>>
> >>>>>>>>> ------------------------------------------------------------
> >>>>>> ----------
> >>>>>>>>> log4j-appserver/pom.xml                         |   8 +
> >>>>>>>>> .../log4j/appserver/jetty/Log4j2Logger.java     | 184
> >>>>>>>> +++++++++++++++++++
> >>>>>>>>> src/changes/changes.xml                         |   3 +
> >>>>>>>>> 3 files changed, 195 insertions(+)
> >>>>>>>>> ------------------------------------------------------------
> >>>>>> ----------
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> >>>>>>>>> 7d52f131/log4j-appserver/pom.xml
> >>>>>>>>> ------------------------------------------------------------
> >>>>>> ----------
> >>>>>>>>> diff --git a/log4j-appserver/pom.xml b/log4j-appserver/pom.xml
> >>>>>>>>> index e96b1fc..6acd77b 100644
> >>>>>>>>> --- a/log4j-appserver/pom.xml
> >>>>>>>>> +++ b/log4j-appserver/pom.xml
> >>>>>>>>> @@ -34,6 +34,7 @@
> >>>>>>>>>  <docLabel>Web Documentation</docLabel>
> >>>>>>>>>  <projectDir>/log4j-appserver</projectDir>
> >>>>>>>>>  <tomcat.version>8.5.20</tomcat.version>
> >>>>>>>>> +    <jetty.version>8.2.0.v20160908</jetty.version> <!--  Jetty
> 9
> >>>>>>>>> requires Java 8 -->
> >>>>>>>>>  <module.name>org.apache.logging.log4j.appserver</module.name>
> >>>>>>>>> </properties>
> >>>>>>>>>
> >>>>>>>>> @@ -56,6 +57,7 @@
> >>>>>>>>>    <groupId>org.apache.tomcat</groupId>
> >>>>>>>>>    <artifactId>tomcat-catalina</artifactId>
> >>>>>>>>>    <version>${tomcat.version}</version>
> >>>>>>>>> +      <scope>provided</scope>
> >>>>>>>>>    <exclusions>
> >>>>>>>>>      <exclusion>
> >>>>>>>>>        <groupId>org.apache.tomcat</groupId>
> >>>>>>>>> @@ -71,6 +73,12 @@
> >>>>>>>>>      </exclusion>
> >>>>>>>>>    </exclusions>
> >>>>>>>>>  </dependency>
> >>>>>>>>> +    <dependency>
> >>>>>>>>> +      <groupId>org.eclipse.jetty</groupId>
> >>>>>>>>> +      <artifactId>jetty-util</artifactId>
> >>>>>>>>> +      <version>${jetty.version}</version>
> >>>>>>>>> +      <scope>provided</scope>
> >>>>>>>>> +    </dependency>
> >>>>>>>>>
> >>>>>>>>>  <!-- Test dependencies -->
> >>>>>>>>>  <dependency>
> >>>>>>>>>
> >>>>>>>>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> >>>>>>>>> 7d52f131/log4j-appserver/src/main/java/org/apache/logging/
> >>>>>>>>> log4j/appserver/jetty/Log4j2Logger.java
> >>>>>>>>> ------------------------------------------------------------
> >>>>>> ----------
> >>>>>>>>> diff --git a/log4j-appserver/src/main/
> >>> java/org/apache/logging/log4j/
> >>>>>>>>> appserver/jetty/Log4j2Logger.java b/log4j-appserver/src/main/
> >>>>>>>>> java/org/apache/logging/log4j/appserver/jetty/Log4j2Logger.java
> >>>>>>>>> new file mode 100644
> >>>>>>>>> index 0000000..7d1ce14
> >>>>>>>>> --- /dev/null
> >>>>>>>>> +++ b/log4j-appserver/src/main/java/org/apache/logging/log4j/
> >>>>>>>>> appserver/jetty/Log4j2Logger.java
> >>>>>>>>> @@ -0,0 +1,184 @@
> >>>>>>>>> +/*
> >>>>>>>>> + * Licensed to the Apache Software Foundation (ASF) under one or
> >>>>>> more
> >>>>>>>>> + * contributor license agreements. See the NOTICE file
> distributed
> >>>>>>> with
> >>>>>>>>> + * this work for additional information regarding copyright
> >>>>>> ownership.
> >>>>>>>>> + * The ASF licenses this file to You under the Apache license,
> >>>>>> Version
> >>>>>>>> 2.0
> >>>>>>>>> + * (the "License"); you may not use this file except in
> compliance
> >>>>>>> with
> >>>>>>>>> + * the License. You may obtain a copy of the License at
> >>>>>>>>> + *
> >>>>>>>>> + *      http://www.apache.org/licenses/LICENSE-2.0
> >>>>>>>>> + *
> >>>>>>>>> + * Unless required by applicable law or agreed to in writing,
> >>>>>> software
> >>>>>>>>> + * distributed under the License is distributed on an "AS IS"
> >>> BASIS,
> >>>>>>>>> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
> or
> >>>>>>>>> implied.
> >>>>>>>>> + * See the license for the specific language governing
> permissions
> >>>>>> and
> >>>>>>>>> + * limitations under the license.
> >>>>>>>>> + */
> >>>>>>>>> +
> >>>>>>>>> +package org.apache.logging.log4j.appserver.jetty;
> >>>>>>>>> +
> >>>>>>>>> +import org.apache.logging.log4j.LogManager;
> >>>>>>>>> +import org.eclipse.jetty.util.log.AbstractLogger;
> >>>>>>>>> +import org.eclipse.jetty.util.log.Logger;
> >>>>>>>>> +
> >>>>>>>>> +/**
> >>>>>>>>> + * Provides a native Apache Log4j 2 for Jetty logging.
> >>>>>>>>> + */
> >>>>>>>>> +public class Log4j2Logger extends AbstractLogger {
> >>>>>>>>> +
> >>>>>>>>> +    private final org.apache.logging.log4j.Logger logger;
> >>>>>>>>> +
> >>>>>>>>> +    private final String name;
> >>>>>>>>> +
> >>>>>>>>> +    public Log4j2Logger(final String name) {
> >>>>>>>>> +        super();
> >>>>>>>>> +        this.name = name;
> >>>>>>>>> +        this.logger = LogManager.getLogger(name);
> >>>>>>>>> +    }
> >>>>>>>>> +
> >>>>>>>>> +    public Log4j2Logger() {
> >>>>>>>>> +        this("");
> >>>>>>>>> +    }
> >>>>>>>>> +
> >>>>>>>>> +    /*
> >>>>>>>>> +     * (non-Javadoc)
> >>>>>>>>> +     *
> >>>>>>>>> +     * @see org.eclipse.jetty.util.log.
> >>>>>> Logger#debug(java.lang.String,
> >>>>>>>>> java.lang.Object[])
> >>>>>>>>> +     */
> >>>>>>>>> +    @Override
> >>>>>>>>> +    public void debug(final String msg, final Object... args) {
> >>>>>>>>> +        logger.debug(msg, args);
> >>>>>>>>> +    }
> >>>>>>>>> +
> >>>>>>>>> +    /*
> >>>>>>>>> +     * (non-Javadoc)
> >>>>>>>>> +     *
> >>>>>>>>> +     * @see org.eclipse.jetty.util.log.
> >>>>>> Logger#debug(java.lang.String,
> >>>>>>>>> java.lang.Throwable)
> >>>>>>>>> +     */
> >>>>>>>>> +    @Override
> >>>>>>>>> +    public void debug(final String msg, final Throwable thrown)
> {
> >>>>>>>>> +        logger.debug(msg, thrown);
> >>>>>>>>> +    }
> >>>>>>>>> +
> >>>>>>>>> +    /*
> >>>>>>>>> +     * (non-Javadoc)
> >>>>>>>>> +     *
> >>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#debug(java.lang.
> >>>>>>>> Throwable)
> >>>>>>>>> +     */
> >>>>>>>>> +    @Override
> >>>>>>>>> +    public void debug(final Throwable thrown) {
> >>>>>>>>> +        logger.debug(thrown);
> >>>>>>>>> +    }
> >>>>>>>>> +
> >>>>>>>>> +    /*
> >>>>>>>>> +     * (non-Javadoc)
> >>>>>>>>> +     *
> >>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#getName()
> >>>>>>>>> +     */
> >>>>>>>>> +    @Override
> >>>>>>>>> +    public String getName() {
> >>>>>>>>> +        return name;
> >>>>>>>>> +    }
> >>>>>>>>> +
> >>>>>>>>> +    /*
> >>>>>>>>> +     * (non-Javadoc)
> >>>>>>>>> +     *
> >>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#ignore(java.lang.
> >>>>>>>> Throwable)
> >>>>>>>>> +     */
> >>>>>>>>> +    @Override
> >>>>>>>>> +    public void ignore(final Throwable ignored) {
> >>>>>>>>> +        // TODO Auto-generated method stub
> >>>>>>>>> +
> >>>>>>>>> +    }
> >>>>>>>>> +
> >>>>>>>>> +    /*
> >>>>>>>>> +     * (non-Javadoc)
> >>>>>>>>> +     *
> >>>>>>>>> +     * @see org.eclipse.jetty.util.log.
> >>>>>> Logger#info(java.lang.String,
> >>>>>>>>> java.lang.Object[])
> >>>>>>>>> +     */
> >>>>>>>>> +    @Override
> >>>>>>>>> +    public void info(final String msg, final Object... args) {
> >>>>>>>>> +        logger.info(msg, args);
> >>>>>>>>> +    }
> >>>>>>>>> +
> >>>>>>>>> +    /*
> >>>>>>>>> +     * (non-Javadoc)
> >>>>>>>>> +     *
> >>>>>>>>> +     * @see org.eclipse.jetty.util.log.
> >>>>>> Logger#info(java.lang.String,
> >>>>>>>>> java.lang.Throwable)
> >>>>>>>>> +     */
> >>>>>>>>> +    @Override
> >>>>>>>>> +    public void info(final String msg, final Throwable thrown) {
> >>>>>>>>> +        logger.info(msg, thrown);
> >>>>>>>>> +    }
> >>>>>>>>> +
> >>>>>>>>> +    /*
> >>>>>>>>> +     * (non-Javadoc)
> >>>>>>>>> +     *
> >>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#info(java.lang.
> >>>>>>> Throwable)
> >>>>>>>>> +     */
> >>>>>>>>> +    @Override
> >>>>>>>>> +    public void info(final Throwable thrown) {
> >>>>>>>>> +        logger.info(thrown);
> >>>>>>>>> +    }
> >>>>>>>>> +
> >>>>>>>>> +    /*
> >>>>>>>>> +     * (non-Javadoc)
> >>>>>>>>> +     *
> >>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#isDebugEnabled()
> >>>>>>>>> +     */
> >>>>>>>>> +    @Override
> >>>>>>>>> +    public boolean isDebugEnabled() {
> >>>>>>>>> +        return logger.isDebugEnabled();
> >>>>>>>>> +    }
> >>>>>>>>> +
> >>>>>>>>> +    /*
> >>>>>>>>> +     * (non-Javadoc)
> >>>>>>>>> +     *
> >>>>>>>>> +     * @see org.eclipse.jetty.util.log.
> >>>>>> AbstractLogger#newLogger(java.
> >>>>>>>>> lang.String)
> >>>>>>>>> +     */
> >>>>>>>>> +    @Override
> >>>>>>>>> +    protected Logger newLogger(final String fullname) {
> >>>>>>>>> +        return new Log4j2Logger(fullname);
> >>>>>>>>> +    }
> >>>>>>>>> +
> >>>>>>>>> +    /*
> >>>>>>>>> +     * (non-Javadoc)
> >>>>>>>>> +     *
> >>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#setDebugEnabled(
> >>>>>>> boolean)
> >>>>>>>>> +     */
> >>>>>>>>> +    @Override
> >>>>>>>>> +    public void setDebugEnabled(final boolean enabled) {
> >>>>>>>>> +        warn("setDebugEnabled not implemented");
> >>>>>>>>> +    }
> >>>>>>>>> +
> >>>>>>>>> +    /*
> >>>>>>>>> +     * (non-Javadoc)
> >>>>>>>>> +     *
> >>>>>>>>> +     * @see org.eclipse.jetty.util.log.
> >>>>>> Logger#warn(java.lang.String,
> >>>>>>>>> java.lang.Object[])
> >>>>>>>>> +     */
> >>>>>>>>> +    @Override
> >>>>>>>>> +    public void warn(final String msg, final Object... args) {
> >>>>>>>>> +        logger.warn(msg, args);
> >>>>>>>>> +    }
> >>>>>>>>> +
> >>>>>>>>> +    /*
> >>>>>>>>> +     * (non-Javadoc)
> >>>>>>>>> +     *
> >>>>>>>>> +     * @see org.eclipse.jetty.util.log.
> >>>>>> Logger#warn(java.lang.String,
> >>>>>>>>> java.lang.Throwable)
> >>>>>>>>> +     */
> >>>>>>>>> +    @Override
> >>>>>>>>> +    public void warn(final String msg, final Throwable thrown) {
> >>>>>>>>> +        logger.warn(msg, thrown);
> >>>>>>>>> +    }
> >>>>>>>>> +
> >>>>>>>>> +    /*
> >>>>>>>>> +     * (non-Javadoc)
> >>>>>>>>> +     *
> >>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#warn(java.lang.
> >>>>>>> Throwable)
> >>>>>>>>> +     */
> >>>>>>>>> +    @Override
> >>>>>>>>> +    public void warn(final Throwable thrown) {
> >>>>>>>>> +        logger.warn(thrown);
> >>>>>>>>> +    }
> >>>>>>>>> +
> >>>>>>>>> +}
> >>>>>>>>>
> >>>>>>>>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> >>>>>>>>> 7d52f131/src/changes/changes.xml
> >>>>>>>>> ------------------------------------------------------------
> >>>>>> ----------
> >>>>>>>>> diff --git a/src/changes/changes.xml b/src/changes/changes.xml
> >>>>>>>>> index 2bcefb2..070e4a1 100644
> >>>>>>>>> --- a/src/changes/changes.xml
> >>>>>>>>> +++ b/src/changes/changes.xml
> >>>>>>>>> @@ -37,6 +37,9 @@
> >>>>>>>>>    <action issue="LOG4J2-2103" dev="mikes" type="add">
> >>>>>>>>>      XML encoding for PatternLayout.
> >>>>>>>>>    </action>
> >>>>>>>>> +      <action issue="LOG4J2-2114" dev="ggregory" type="add">
> >>>>>>>>> +        Provide a native Log4j 2 implementation of Eclipse
> Jetty's
> >>>>>>>>> org.eclipse.jetty.util.log.Logger.
> >>>>>>>>> +      </action>
> >>>>>>>>>    <action issue="LOG4J2-1203" dev="mikes" type="add"
> >>>>>>> due-to="Robert
> >>>>>>>>> Turner">
> >>>>>>>>>      Allow filtering of line breaks in layout pattern.
> >>>>>>>>>    </action>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> --
> >>>>>>>> Matt Sicker <bo...@gmail.com>
> >>>>>>>>
> >>>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> --
> >>>>>> Matt Sicker <bo...@gmail.com>
> >>>>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >
> >
> >
>
>
>

Re: logging-log4j2 git commit: [LOG4J2-2114] Provide a native Log4j 2 implementation of Eclipse Jetty's org.eclipse.jetty.util.log.Logger.

Posted by Ralph Goers <ra...@dslextreme.com>.
Are you planning on fixing this?

Ralph

> On Nov 11, 2017, at 5:15 PM, Ralph Goers <ra...@dslextreme.com> wrote:
> 
> Because the caller of newLogger(name) is AbstractLogger its ClassLoader will always be used. You need the ClassLoader of the caller of getLogger().
> 
> Ralph
> 
>> On Nov 11, 2017, at 3:43 PM, Gary Gregory <ga...@gmail.com> wrote:
>> 
>> Please code review git master. I'm not sure I have the class loader right.
>> 
>> Gary
>> 
>> On Sat, Nov 11, 2017 at 2:54 PM, Ralph Goers <ra...@dslextreme.com>
>> wrote:
>> 
>>> Oh, but you probably don’t want to extend AbstractLogger. You really want
>>> the FQCN of the caller to be able to identify the ClassLoader and
>>> LoggerContext to use and you won’t get that from AbstractLogger’s getLogger
>>> method.
>>> 
>>> Ralph
>>> 
>>>> On Nov 11, 2017, at 2:45 PM, Ralph Goers <ra...@dslextreme.com>
>>> wrote:
>>>> 
>>>> Sure. Look at TomcatLogger. It does exactly what you are trying to do.
>>>> 
>>>> Ralph
>>>> 
>>>>> On Nov 11, 2017, at 2:02 PM, Gary Gregory <ga...@gmail.com>
>>> wrote:
>>>>> 
>>>>> The Javadoc for Log4j's LoggerAdapter says "This registry should not be
>>>>> used for Log4j Loggers; it is instead used for creating bridges to other
>>>>> external log systems.".
>>>>> 
>>>>> In this case we are not bridging TO another log system. We are plugging
>>>>> INTO Jetty's log system and subclassing Jetty's own LoggerAdapter class
>>>>> (out convenience.)
>>>>> 
>>>>> Further thoughts?
>>>>> 
>>>>> Gary
>>>>> 
>>>>> On Fri, Nov 10, 2017 at 9:25 PM, Matt Sicker <bo...@gmail.com> wrote:
>>>>> 
>>>>>> IIRC, the easiest way to support it might be to use
>>>>>> https://logging.apache.org/log4j/2.x/log4j-api/apidocs/
>>>>>> org/apache/logging/log4j/spi/AbstractLoggerAdapter.html
>>>>>> 
>>>>>> On 10 November 2017 at 22:16, Gary Gregory <ga...@gmail.com>
>>> wrote:
>>>>>> 
>>>>>>> I think you are correct...
>>>>>>> 
>>>>>>> Gary
>>>>>>> 
>>>>>>> On Fri, Nov 10, 2017 at 6:59 PM, Matt Sicker <bo...@gmail.com>
>>> wrote:
>>>>>>> 
>>>>>>>> Wouldn't this implementation contain incorrect caller location
>>>>>>> information?
>>>>>>>> 
>>>>>>>> On 10 November 2017 at 19:25, <gg...@apache.org> wrote:
>>>>>>>> 
>>>>>>>>> Repository: logging-log4j2
>>>>>>>>> Updated Branches:
>>>>>>>>> refs/heads/master aad2f132b -> 7d52f131e
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> [LOG4J2-2114] Provide a native Log4j 2 implementation of Eclipse
>>>>>>> Jetty's
>>>>>>>>> org.eclipse.jetty.util.log.Logger.
>>>>>>>>> 
>>>>>>>>> Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
>>>>>>>>> Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/
>>>>>>>>> commit/7d52f131
>>>>>>>>> Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/
>>>>>>>> 7d52f131
>>>>>>>>> Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/
>>>>>>>> 7d52f131
>>>>>>>>> 
>>>>>>>>> Branch: refs/heads/master
>>>>>>>>> Commit: 7d52f131ec1e000834bcb40343f3f2d41805c75a
>>>>>>>>> Parents: aad2f13
>>>>>>>>> Author: Gary Gregory <gg...@apache.org>
>>>>>>>>> Authored: Fri Nov 10 18:25:47 2017 -0700
>>>>>>>>> Committer: Gary Gregory <gg...@apache.org>
>>>>>>>>> Committed: Fri Nov 10 18:25:47 2017 -0700
>>>>>>>>> 
>>>>>>>>> ------------------------------------------------------------
>>>>>> ----------
>>>>>>>>> log4j-appserver/pom.xml                         |   8 +
>>>>>>>>> .../log4j/appserver/jetty/Log4j2Logger.java     | 184
>>>>>>>> +++++++++++++++++++
>>>>>>>>> src/changes/changes.xml                         |   3 +
>>>>>>>>> 3 files changed, 195 insertions(+)
>>>>>>>>> ------------------------------------------------------------
>>>>>> ----------
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
>>>>>>>>> 7d52f131/log4j-appserver/pom.xml
>>>>>>>>> ------------------------------------------------------------
>>>>>> ----------
>>>>>>>>> diff --git a/log4j-appserver/pom.xml b/log4j-appserver/pom.xml
>>>>>>>>> index e96b1fc..6acd77b 100644
>>>>>>>>> --- a/log4j-appserver/pom.xml
>>>>>>>>> +++ b/log4j-appserver/pom.xml
>>>>>>>>> @@ -34,6 +34,7 @@
>>>>>>>>>  <docLabel>Web Documentation</docLabel>
>>>>>>>>>  <projectDir>/log4j-appserver</projectDir>
>>>>>>>>>  <tomcat.version>8.5.20</tomcat.version>
>>>>>>>>> +    <jetty.version>8.2.0.v20160908</jetty.version> <!--  Jetty 9
>>>>>>>>> requires Java 8 -->
>>>>>>>>>  <module.name>org.apache.logging.log4j.appserver</module.name>
>>>>>>>>> </properties>
>>>>>>>>> 
>>>>>>>>> @@ -56,6 +57,7 @@
>>>>>>>>>    <groupId>org.apache.tomcat</groupId>
>>>>>>>>>    <artifactId>tomcat-catalina</artifactId>
>>>>>>>>>    <version>${tomcat.version}</version>
>>>>>>>>> +      <scope>provided</scope>
>>>>>>>>>    <exclusions>
>>>>>>>>>      <exclusion>
>>>>>>>>>        <groupId>org.apache.tomcat</groupId>
>>>>>>>>> @@ -71,6 +73,12 @@
>>>>>>>>>      </exclusion>
>>>>>>>>>    </exclusions>
>>>>>>>>>  </dependency>
>>>>>>>>> +    <dependency>
>>>>>>>>> +      <groupId>org.eclipse.jetty</groupId>
>>>>>>>>> +      <artifactId>jetty-util</artifactId>
>>>>>>>>> +      <version>${jetty.version}</version>
>>>>>>>>> +      <scope>provided</scope>
>>>>>>>>> +    </dependency>
>>>>>>>>> 
>>>>>>>>>  <!-- Test dependencies -->
>>>>>>>>>  <dependency>
>>>>>>>>> 
>>>>>>>>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
>>>>>>>>> 7d52f131/log4j-appserver/src/main/java/org/apache/logging/
>>>>>>>>> log4j/appserver/jetty/Log4j2Logger.java
>>>>>>>>> ------------------------------------------------------------
>>>>>> ----------
>>>>>>>>> diff --git a/log4j-appserver/src/main/
>>> java/org/apache/logging/log4j/
>>>>>>>>> appserver/jetty/Log4j2Logger.java b/log4j-appserver/src/main/
>>>>>>>>> java/org/apache/logging/log4j/appserver/jetty/Log4j2Logger.java
>>>>>>>>> new file mode 100644
>>>>>>>>> index 0000000..7d1ce14
>>>>>>>>> --- /dev/null
>>>>>>>>> +++ b/log4j-appserver/src/main/java/org/apache/logging/log4j/
>>>>>>>>> appserver/jetty/Log4j2Logger.java
>>>>>>>>> @@ -0,0 +1,184 @@
>>>>>>>>> +/*
>>>>>>>>> + * Licensed to the Apache Software Foundation (ASF) under one or
>>>>>> more
>>>>>>>>> + * contributor license agreements. See the NOTICE file distributed
>>>>>>> with
>>>>>>>>> + * this work for additional information regarding copyright
>>>>>> ownership.
>>>>>>>>> + * The ASF licenses this file to You under the Apache license,
>>>>>> Version
>>>>>>>> 2.0
>>>>>>>>> + * (the "License"); you may not use this file except in compliance
>>>>>>> with
>>>>>>>>> + * the License. You may obtain a copy of the License at
>>>>>>>>> + *
>>>>>>>>> + *      http://www.apache.org/licenses/LICENSE-2.0
>>>>>>>>> + *
>>>>>>>>> + * Unless required by applicable law or agreed to in writing,
>>>>>> software
>>>>>>>>> + * distributed under the License is distributed on an "AS IS"
>>> BASIS,
>>>>>>>>> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>>>>>>>>> implied.
>>>>>>>>> + * See the license for the specific language governing permissions
>>>>>> and
>>>>>>>>> + * limitations under the license.
>>>>>>>>> + */
>>>>>>>>> +
>>>>>>>>> +package org.apache.logging.log4j.appserver.jetty;
>>>>>>>>> +
>>>>>>>>> +import org.apache.logging.log4j.LogManager;
>>>>>>>>> +import org.eclipse.jetty.util.log.AbstractLogger;
>>>>>>>>> +import org.eclipse.jetty.util.log.Logger;
>>>>>>>>> +
>>>>>>>>> +/**
>>>>>>>>> + * Provides a native Apache Log4j 2 for Jetty logging.
>>>>>>>>> + */
>>>>>>>>> +public class Log4j2Logger extends AbstractLogger {
>>>>>>>>> +
>>>>>>>>> +    private final org.apache.logging.log4j.Logger logger;
>>>>>>>>> +
>>>>>>>>> +    private final String name;
>>>>>>>>> +
>>>>>>>>> +    public Log4j2Logger(final String name) {
>>>>>>>>> +        super();
>>>>>>>>> +        this.name = name;
>>>>>>>>> +        this.logger = LogManager.getLogger(name);
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    public Log4j2Logger() {
>>>>>>>>> +        this("");
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    /*
>>>>>>>>> +     * (non-Javadoc)
>>>>>>>>> +     *
>>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>>>>>> Logger#debug(java.lang.String,
>>>>>>>>> java.lang.Object[])
>>>>>>>>> +     */
>>>>>>>>> +    @Override
>>>>>>>>> +    public void debug(final String msg, final Object... args) {
>>>>>>>>> +        logger.debug(msg, args);
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    /*
>>>>>>>>> +     * (non-Javadoc)
>>>>>>>>> +     *
>>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>>>>>> Logger#debug(java.lang.String,
>>>>>>>>> java.lang.Throwable)
>>>>>>>>> +     */
>>>>>>>>> +    @Override
>>>>>>>>> +    public void debug(final String msg, final Throwable thrown) {
>>>>>>>>> +        logger.debug(msg, thrown);
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    /*
>>>>>>>>> +     * (non-Javadoc)
>>>>>>>>> +     *
>>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#debug(java.lang.
>>>>>>>> Throwable)
>>>>>>>>> +     */
>>>>>>>>> +    @Override
>>>>>>>>> +    public void debug(final Throwable thrown) {
>>>>>>>>> +        logger.debug(thrown);
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    /*
>>>>>>>>> +     * (non-Javadoc)
>>>>>>>>> +     *
>>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#getName()
>>>>>>>>> +     */
>>>>>>>>> +    @Override
>>>>>>>>> +    public String getName() {
>>>>>>>>> +        return name;
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    /*
>>>>>>>>> +     * (non-Javadoc)
>>>>>>>>> +     *
>>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#ignore(java.lang.
>>>>>>>> Throwable)
>>>>>>>>> +     */
>>>>>>>>> +    @Override
>>>>>>>>> +    public void ignore(final Throwable ignored) {
>>>>>>>>> +        // TODO Auto-generated method stub
>>>>>>>>> +
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    /*
>>>>>>>>> +     * (non-Javadoc)
>>>>>>>>> +     *
>>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>>>>>> Logger#info(java.lang.String,
>>>>>>>>> java.lang.Object[])
>>>>>>>>> +     */
>>>>>>>>> +    @Override
>>>>>>>>> +    public void info(final String msg, final Object... args) {
>>>>>>>>> +        logger.info(msg, args);
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    /*
>>>>>>>>> +     * (non-Javadoc)
>>>>>>>>> +     *
>>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>>>>>> Logger#info(java.lang.String,
>>>>>>>>> java.lang.Throwable)
>>>>>>>>> +     */
>>>>>>>>> +    @Override
>>>>>>>>> +    public void info(final String msg, final Throwable thrown) {
>>>>>>>>> +        logger.info(msg, thrown);
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    /*
>>>>>>>>> +     * (non-Javadoc)
>>>>>>>>> +     *
>>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#info(java.lang.
>>>>>>> Throwable)
>>>>>>>>> +     */
>>>>>>>>> +    @Override
>>>>>>>>> +    public void info(final Throwable thrown) {
>>>>>>>>> +        logger.info(thrown);
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    /*
>>>>>>>>> +     * (non-Javadoc)
>>>>>>>>> +     *
>>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#isDebugEnabled()
>>>>>>>>> +     */
>>>>>>>>> +    @Override
>>>>>>>>> +    public boolean isDebugEnabled() {
>>>>>>>>> +        return logger.isDebugEnabled();
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    /*
>>>>>>>>> +     * (non-Javadoc)
>>>>>>>>> +     *
>>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>>>>>> AbstractLogger#newLogger(java.
>>>>>>>>> lang.String)
>>>>>>>>> +     */
>>>>>>>>> +    @Override
>>>>>>>>> +    protected Logger newLogger(final String fullname) {
>>>>>>>>> +        return new Log4j2Logger(fullname);
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    /*
>>>>>>>>> +     * (non-Javadoc)
>>>>>>>>> +     *
>>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#setDebugEnabled(
>>>>>>> boolean)
>>>>>>>>> +     */
>>>>>>>>> +    @Override
>>>>>>>>> +    public void setDebugEnabled(final boolean enabled) {
>>>>>>>>> +        warn("setDebugEnabled not implemented");
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    /*
>>>>>>>>> +     * (non-Javadoc)
>>>>>>>>> +     *
>>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>>>>>> Logger#warn(java.lang.String,
>>>>>>>>> java.lang.Object[])
>>>>>>>>> +     */
>>>>>>>>> +    @Override
>>>>>>>>> +    public void warn(final String msg, final Object... args) {
>>>>>>>>> +        logger.warn(msg, args);
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    /*
>>>>>>>>> +     * (non-Javadoc)
>>>>>>>>> +     *
>>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>>>>>> Logger#warn(java.lang.String,
>>>>>>>>> java.lang.Throwable)
>>>>>>>>> +     */
>>>>>>>>> +    @Override
>>>>>>>>> +    public void warn(final String msg, final Throwable thrown) {
>>>>>>>>> +        logger.warn(msg, thrown);
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    /*
>>>>>>>>> +     * (non-Javadoc)
>>>>>>>>> +     *
>>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#warn(java.lang.
>>>>>>> Throwable)
>>>>>>>>> +     */
>>>>>>>>> +    @Override
>>>>>>>>> +    public void warn(final Throwable thrown) {
>>>>>>>>> +        logger.warn(thrown);
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +}
>>>>>>>>> 
>>>>>>>>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
>>>>>>>>> 7d52f131/src/changes/changes.xml
>>>>>>>>> ------------------------------------------------------------
>>>>>> ----------
>>>>>>>>> diff --git a/src/changes/changes.xml b/src/changes/changes.xml
>>>>>>>>> index 2bcefb2..070e4a1 100644
>>>>>>>>> --- a/src/changes/changes.xml
>>>>>>>>> +++ b/src/changes/changes.xml
>>>>>>>>> @@ -37,6 +37,9 @@
>>>>>>>>>    <action issue="LOG4J2-2103" dev="mikes" type="add">
>>>>>>>>>      XML encoding for PatternLayout.
>>>>>>>>>    </action>
>>>>>>>>> +      <action issue="LOG4J2-2114" dev="ggregory" type="add">
>>>>>>>>> +        Provide a native Log4j 2 implementation of Eclipse Jetty's
>>>>>>>>> org.eclipse.jetty.util.log.Logger.
>>>>>>>>> +      </action>
>>>>>>>>>    <action issue="LOG4J2-1203" dev="mikes" type="add"
>>>>>>> due-to="Robert
>>>>>>>>> Turner">
>>>>>>>>>      Allow filtering of line breaks in layout pattern.
>>>>>>>>>    </action>
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> --
>>>>>>>> Matt Sicker <bo...@gmail.com>
>>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> --
>>>>>> Matt Sicker <bo...@gmail.com>
>>>>>> 
>>>> 
>>>> 
>>>> 
>>> 
>>> 
>>> 
> 
> 
> 



Re: logging-log4j2 git commit: [LOG4J2-2114] Provide a native Log4j 2 implementation of Eclipse Jetty's org.eclipse.jetty.util.log.Logger.

Posted by Ralph Goers <ra...@dslextreme.com>.
Because the caller of newLogger(name) is AbstractLogger its ClassLoader will always be used. You need the ClassLoader of the caller of getLogger().

Ralph

> On Nov 11, 2017, at 3:43 PM, Gary Gregory <ga...@gmail.com> wrote:
> 
> Please code review git master. I'm not sure I have the class loader right.
> 
> Gary
> 
> On Sat, Nov 11, 2017 at 2:54 PM, Ralph Goers <ra...@dslextreme.com>
> wrote:
> 
>> Oh, but you probably don’t want to extend AbstractLogger. You really want
>> the FQCN of the caller to be able to identify the ClassLoader and
>> LoggerContext to use and you won’t get that from AbstractLogger’s getLogger
>> method.
>> 
>> Ralph
>> 
>>> On Nov 11, 2017, at 2:45 PM, Ralph Goers <ra...@dslextreme.com>
>> wrote:
>>> 
>>> Sure. Look at TomcatLogger. It does exactly what you are trying to do.
>>> 
>>> Ralph
>>> 
>>>> On Nov 11, 2017, at 2:02 PM, Gary Gregory <ga...@gmail.com>
>> wrote:
>>>> 
>>>> The Javadoc for Log4j's LoggerAdapter says "This registry should not be
>>>> used for Log4j Loggers; it is instead used for creating bridges to other
>>>> external log systems.".
>>>> 
>>>> In this case we are not bridging TO another log system. We are plugging
>>>> INTO Jetty's log system and subclassing Jetty's own LoggerAdapter class
>>>> (out convenience.)
>>>> 
>>>> Further thoughts?
>>>> 
>>>> Gary
>>>> 
>>>> On Fri, Nov 10, 2017 at 9:25 PM, Matt Sicker <bo...@gmail.com> wrote:
>>>> 
>>>>> IIRC, the easiest way to support it might be to use
>>>>> https://logging.apache.org/log4j/2.x/log4j-api/apidocs/
>>>>> org/apache/logging/log4j/spi/AbstractLoggerAdapter.html
>>>>> 
>>>>> On 10 November 2017 at 22:16, Gary Gregory <ga...@gmail.com>
>> wrote:
>>>>> 
>>>>>> I think you are correct...
>>>>>> 
>>>>>> Gary
>>>>>> 
>>>>>> On Fri, Nov 10, 2017 at 6:59 PM, Matt Sicker <bo...@gmail.com>
>> wrote:
>>>>>> 
>>>>>>> Wouldn't this implementation contain incorrect caller location
>>>>>> information?
>>>>>>> 
>>>>>>> On 10 November 2017 at 19:25, <gg...@apache.org> wrote:
>>>>>>> 
>>>>>>>> Repository: logging-log4j2
>>>>>>>> Updated Branches:
>>>>>>>> refs/heads/master aad2f132b -> 7d52f131e
>>>>>>>> 
>>>>>>>> 
>>>>>>>> [LOG4J2-2114] Provide a native Log4j 2 implementation of Eclipse
>>>>>> Jetty's
>>>>>>>> org.eclipse.jetty.util.log.Logger.
>>>>>>>> 
>>>>>>>> Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
>>>>>>>> Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/
>>>>>>>> commit/7d52f131
>>>>>>>> Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/
>>>>>>> 7d52f131
>>>>>>>> Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/
>>>>>>> 7d52f131
>>>>>>>> 
>>>>>>>> Branch: refs/heads/master
>>>>>>>> Commit: 7d52f131ec1e000834bcb40343f3f2d41805c75a
>>>>>>>> Parents: aad2f13
>>>>>>>> Author: Gary Gregory <gg...@apache.org>
>>>>>>>> Authored: Fri Nov 10 18:25:47 2017 -0700
>>>>>>>> Committer: Gary Gregory <gg...@apache.org>
>>>>>>>> Committed: Fri Nov 10 18:25:47 2017 -0700
>>>>>>>> 
>>>>>>>> ------------------------------------------------------------
>>>>> ----------
>>>>>>>> log4j-appserver/pom.xml                         |   8 +
>>>>>>>> .../log4j/appserver/jetty/Log4j2Logger.java     | 184
>>>>>>> +++++++++++++++++++
>>>>>>>> src/changes/changes.xml                         |   3 +
>>>>>>>> 3 files changed, 195 insertions(+)
>>>>>>>> ------------------------------------------------------------
>>>>> ----------
>>>>>>>> 
>>>>>>>> 
>>>>>>>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
>>>>>>>> 7d52f131/log4j-appserver/pom.xml
>>>>>>>> ------------------------------------------------------------
>>>>> ----------
>>>>>>>> diff --git a/log4j-appserver/pom.xml b/log4j-appserver/pom.xml
>>>>>>>> index e96b1fc..6acd77b 100644
>>>>>>>> --- a/log4j-appserver/pom.xml
>>>>>>>> +++ b/log4j-appserver/pom.xml
>>>>>>>> @@ -34,6 +34,7 @@
>>>>>>>>   <docLabel>Web Documentation</docLabel>
>>>>>>>>   <projectDir>/log4j-appserver</projectDir>
>>>>>>>>   <tomcat.version>8.5.20</tomcat.version>
>>>>>>>> +    <jetty.version>8.2.0.v20160908</jetty.version> <!--  Jetty 9
>>>>>>>> requires Java 8 -->
>>>>>>>>   <module.name>org.apache.logging.log4j.appserver</module.name>
>>>>>>>> </properties>
>>>>>>>> 
>>>>>>>> @@ -56,6 +57,7 @@
>>>>>>>>     <groupId>org.apache.tomcat</groupId>
>>>>>>>>     <artifactId>tomcat-catalina</artifactId>
>>>>>>>>     <version>${tomcat.version}</version>
>>>>>>>> +      <scope>provided</scope>
>>>>>>>>     <exclusions>
>>>>>>>>       <exclusion>
>>>>>>>>         <groupId>org.apache.tomcat</groupId>
>>>>>>>> @@ -71,6 +73,12 @@
>>>>>>>>       </exclusion>
>>>>>>>>     </exclusions>
>>>>>>>>   </dependency>
>>>>>>>> +    <dependency>
>>>>>>>> +      <groupId>org.eclipse.jetty</groupId>
>>>>>>>> +      <artifactId>jetty-util</artifactId>
>>>>>>>> +      <version>${jetty.version}</version>
>>>>>>>> +      <scope>provided</scope>
>>>>>>>> +    </dependency>
>>>>>>>> 
>>>>>>>>   <!-- Test dependencies -->
>>>>>>>>   <dependency>
>>>>>>>> 
>>>>>>>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
>>>>>>>> 7d52f131/log4j-appserver/src/main/java/org/apache/logging/
>>>>>>>> log4j/appserver/jetty/Log4j2Logger.java
>>>>>>>> ------------------------------------------------------------
>>>>> ----------
>>>>>>>> diff --git a/log4j-appserver/src/main/
>> java/org/apache/logging/log4j/
>>>>>>>> appserver/jetty/Log4j2Logger.java b/log4j-appserver/src/main/
>>>>>>>> java/org/apache/logging/log4j/appserver/jetty/Log4j2Logger.java
>>>>>>>> new file mode 100644
>>>>>>>> index 0000000..7d1ce14
>>>>>>>> --- /dev/null
>>>>>>>> +++ b/log4j-appserver/src/main/java/org/apache/logging/log4j/
>>>>>>>> appserver/jetty/Log4j2Logger.java
>>>>>>>> @@ -0,0 +1,184 @@
>>>>>>>> +/*
>>>>>>>> + * Licensed to the Apache Software Foundation (ASF) under one or
>>>>> more
>>>>>>>> + * contributor license agreements. See the NOTICE file distributed
>>>>>> with
>>>>>>>> + * this work for additional information regarding copyright
>>>>> ownership.
>>>>>>>> + * The ASF licenses this file to You under the Apache license,
>>>>> Version
>>>>>>> 2.0
>>>>>>>> + * (the "License"); you may not use this file except in compliance
>>>>>> with
>>>>>>>> + * the License. You may obtain a copy of the License at
>>>>>>>> + *
>>>>>>>> + *      http://www.apache.org/licenses/LICENSE-2.0
>>>>>>>> + *
>>>>>>>> + * Unless required by applicable law or agreed to in writing,
>>>>> software
>>>>>>>> + * distributed under the License is distributed on an "AS IS"
>> BASIS,
>>>>>>>> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>>>>>>>> implied.
>>>>>>>> + * See the license for the specific language governing permissions
>>>>> and
>>>>>>>> + * limitations under the license.
>>>>>>>> + */
>>>>>>>> +
>>>>>>>> +package org.apache.logging.log4j.appserver.jetty;
>>>>>>>> +
>>>>>>>> +import org.apache.logging.log4j.LogManager;
>>>>>>>> +import org.eclipse.jetty.util.log.AbstractLogger;
>>>>>>>> +import org.eclipse.jetty.util.log.Logger;
>>>>>>>> +
>>>>>>>> +/**
>>>>>>>> + * Provides a native Apache Log4j 2 for Jetty logging.
>>>>>>>> + */
>>>>>>>> +public class Log4j2Logger extends AbstractLogger {
>>>>>>>> +
>>>>>>>> +    private final org.apache.logging.log4j.Logger logger;
>>>>>>>> +
>>>>>>>> +    private final String name;
>>>>>>>> +
>>>>>>>> +    public Log4j2Logger(final String name) {
>>>>>>>> +        super();
>>>>>>>> +        this.name = name;
>>>>>>>> +        this.logger = LogManager.getLogger(name);
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    public Log4j2Logger() {
>>>>>>>> +        this("");
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    /*
>>>>>>>> +     * (non-Javadoc)
>>>>>>>> +     *
>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>>>>> Logger#debug(java.lang.String,
>>>>>>>> java.lang.Object[])
>>>>>>>> +     */
>>>>>>>> +    @Override
>>>>>>>> +    public void debug(final String msg, final Object... args) {
>>>>>>>> +        logger.debug(msg, args);
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    /*
>>>>>>>> +     * (non-Javadoc)
>>>>>>>> +     *
>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>>>>> Logger#debug(java.lang.String,
>>>>>>>> java.lang.Throwable)
>>>>>>>> +     */
>>>>>>>> +    @Override
>>>>>>>> +    public void debug(final String msg, final Throwable thrown) {
>>>>>>>> +        logger.debug(msg, thrown);
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    /*
>>>>>>>> +     * (non-Javadoc)
>>>>>>>> +     *
>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#debug(java.lang.
>>>>>>> Throwable)
>>>>>>>> +     */
>>>>>>>> +    @Override
>>>>>>>> +    public void debug(final Throwable thrown) {
>>>>>>>> +        logger.debug(thrown);
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    /*
>>>>>>>> +     * (non-Javadoc)
>>>>>>>> +     *
>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#getName()
>>>>>>>> +     */
>>>>>>>> +    @Override
>>>>>>>> +    public String getName() {
>>>>>>>> +        return name;
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    /*
>>>>>>>> +     * (non-Javadoc)
>>>>>>>> +     *
>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#ignore(java.lang.
>>>>>>> Throwable)
>>>>>>>> +     */
>>>>>>>> +    @Override
>>>>>>>> +    public void ignore(final Throwable ignored) {
>>>>>>>> +        // TODO Auto-generated method stub
>>>>>>>> +
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    /*
>>>>>>>> +     * (non-Javadoc)
>>>>>>>> +     *
>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>>>>> Logger#info(java.lang.String,
>>>>>>>> java.lang.Object[])
>>>>>>>> +     */
>>>>>>>> +    @Override
>>>>>>>> +    public void info(final String msg, final Object... args) {
>>>>>>>> +        logger.info(msg, args);
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    /*
>>>>>>>> +     * (non-Javadoc)
>>>>>>>> +     *
>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>>>>> Logger#info(java.lang.String,
>>>>>>>> java.lang.Throwable)
>>>>>>>> +     */
>>>>>>>> +    @Override
>>>>>>>> +    public void info(final String msg, final Throwable thrown) {
>>>>>>>> +        logger.info(msg, thrown);
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    /*
>>>>>>>> +     * (non-Javadoc)
>>>>>>>> +     *
>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#info(java.lang.
>>>>>> Throwable)
>>>>>>>> +     */
>>>>>>>> +    @Override
>>>>>>>> +    public void info(final Throwable thrown) {
>>>>>>>> +        logger.info(thrown);
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    /*
>>>>>>>> +     * (non-Javadoc)
>>>>>>>> +     *
>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#isDebugEnabled()
>>>>>>>> +     */
>>>>>>>> +    @Override
>>>>>>>> +    public boolean isDebugEnabled() {
>>>>>>>> +        return logger.isDebugEnabled();
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    /*
>>>>>>>> +     * (non-Javadoc)
>>>>>>>> +     *
>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>>>>> AbstractLogger#newLogger(java.
>>>>>>>> lang.String)
>>>>>>>> +     */
>>>>>>>> +    @Override
>>>>>>>> +    protected Logger newLogger(final String fullname) {
>>>>>>>> +        return new Log4j2Logger(fullname);
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    /*
>>>>>>>> +     * (non-Javadoc)
>>>>>>>> +     *
>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#setDebugEnabled(
>>>>>> boolean)
>>>>>>>> +     */
>>>>>>>> +    @Override
>>>>>>>> +    public void setDebugEnabled(final boolean enabled) {
>>>>>>>> +        warn("setDebugEnabled not implemented");
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    /*
>>>>>>>> +     * (non-Javadoc)
>>>>>>>> +     *
>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>>>>> Logger#warn(java.lang.String,
>>>>>>>> java.lang.Object[])
>>>>>>>> +     */
>>>>>>>> +    @Override
>>>>>>>> +    public void warn(final String msg, final Object... args) {
>>>>>>>> +        logger.warn(msg, args);
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    /*
>>>>>>>> +     * (non-Javadoc)
>>>>>>>> +     *
>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>>>>> Logger#warn(java.lang.String,
>>>>>>>> java.lang.Throwable)
>>>>>>>> +     */
>>>>>>>> +    @Override
>>>>>>>> +    public void warn(final String msg, final Throwable thrown) {
>>>>>>>> +        logger.warn(msg, thrown);
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    /*
>>>>>>>> +     * (non-Javadoc)
>>>>>>>> +     *
>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#warn(java.lang.
>>>>>> Throwable)
>>>>>>>> +     */
>>>>>>>> +    @Override
>>>>>>>> +    public void warn(final Throwable thrown) {
>>>>>>>> +        logger.warn(thrown);
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +}
>>>>>>>> 
>>>>>>>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
>>>>>>>> 7d52f131/src/changes/changes.xml
>>>>>>>> ------------------------------------------------------------
>>>>> ----------
>>>>>>>> diff --git a/src/changes/changes.xml b/src/changes/changes.xml
>>>>>>>> index 2bcefb2..070e4a1 100644
>>>>>>>> --- a/src/changes/changes.xml
>>>>>>>> +++ b/src/changes/changes.xml
>>>>>>>> @@ -37,6 +37,9 @@
>>>>>>>>     <action issue="LOG4J2-2103" dev="mikes" type="add">
>>>>>>>>       XML encoding for PatternLayout.
>>>>>>>>     </action>
>>>>>>>> +      <action issue="LOG4J2-2114" dev="ggregory" type="add">
>>>>>>>> +        Provide a native Log4j 2 implementation of Eclipse Jetty's
>>>>>>>> org.eclipse.jetty.util.log.Logger.
>>>>>>>> +      </action>
>>>>>>>>     <action issue="LOG4J2-1203" dev="mikes" type="add"
>>>>>> due-to="Robert
>>>>>>>> Turner">
>>>>>>>>       Allow filtering of line breaks in layout pattern.
>>>>>>>>     </action>
>>>>>>>> 
>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> --
>>>>>>> Matt Sicker <bo...@gmail.com>
>>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> --
>>>>> Matt Sicker <bo...@gmail.com>
>>>>> 
>>> 
>>> 
>>> 
>> 
>> 
>> 



Re: logging-log4j2 git commit: [LOG4J2-2114] Provide a native Log4j 2 implementation of Eclipse Jetty's org.eclipse.jetty.util.log.Logger.

Posted by Mikael Ståldal <mi...@apache.org>.
Nice.

Too bad that Jetty doesn't support automatic discovery of logging impl 
as Tomcat do. Maybe we should issue a feature request about that?


On 2017-11-13 16:49, Gary Gregory wrote:
> I also updated log4j-appserver/src/site/markdown/index.md.vm
> 
> Thank you!
> Gary
> 
> On Mon, Nov 13, 2017 at 8:04 AM, Gary Gregory <ga...@gmail.com>
> wrote:
> 
>> Oh, I added a section to the main index:
>>
>> #h3 Integrating with Application Servers
>>
>> Version 2.10.0 introduces a the module log4j-appserver to improve
>> integration with Apache Tomcat and Eclipse Jetty.
>>
>> Gary
>>
>> On Sun, Nov 12, 2017 at 10:10 AM, Mikael Ståldal <mi...@apache.org> wrote:
>>
>>> On 2017-11-12 16:00, Gary Gregory wrote:
>>>
>>>> On Sun, Nov 12, 2017 at 7:25 AM, Mikael Ståldal <mi...@apache.org>
>>>> wrote:
>>>>
>>>> Do we want a package-info.java in the Jetty package, like in the Tomcat
>>>>> package?
>>>>>
>>>>> And you should probably add a section about Jetty integraion in
>>>>> log4j-appserver/src/site/markdown/index.md.vm
>>>>>
>>>>
>>>> Done. Please review.
>>>>
>>>
>>> I don't see anything about Jetty in log4j-appserver/src/site/markd
>>> own/index.md.vm
>>>
>>>
>>
> 


Re: logging-log4j2 git commit: [LOG4J2-2114] Provide a native Log4j 2 implementation of Eclipse Jetty's org.eclipse.jetty.util.log.Logger.

Posted by Gary Gregory <ga...@gmail.com>.
I also updated log4j-appserver/src/site/markdown/index.md.vm

Thank you!
Gary

On Mon, Nov 13, 2017 at 8:04 AM, Gary Gregory <ga...@gmail.com>
wrote:

> Oh, I added a section to the main index:
>
> #h3 Integrating with Application Servers
>
> Version 2.10.0 introduces a the module log4j-appserver to improve
> integration with Apache Tomcat and Eclipse Jetty.
>
> Gary
>
> On Sun, Nov 12, 2017 at 10:10 AM, Mikael Ståldal <mi...@apache.org> wrote:
>
>> On 2017-11-12 16:00, Gary Gregory wrote:
>>
>>> On Sun, Nov 12, 2017 at 7:25 AM, Mikael Ståldal <mi...@apache.org>
>>> wrote:
>>>
>>> Do we want a package-info.java in the Jetty package, like in the Tomcat
>>>> package?
>>>>
>>>> And you should probably add a section about Jetty integraion in
>>>> log4j-appserver/src/site/markdown/index.md.vm
>>>>
>>>
>>> Done. Please review.
>>>
>>
>> I don't see anything about Jetty in log4j-appserver/src/site/markd
>> own/index.md.vm
>>
>>
>

Re: logging-log4j2 git commit: [LOG4J2-2114] Provide a native Log4j 2 implementation of Eclipse Jetty's org.eclipse.jetty.util.log.Logger.

Posted by Gary Gregory <ga...@gmail.com>.
Oh, I added a section to the main index:

#h3 Integrating with Application Servers

Version 2.10.0 introduces a the module log4j-appserver to improve
integration with Apache Tomcat and Eclipse Jetty.

Gary

On Sun, Nov 12, 2017 at 10:10 AM, Mikael Ståldal <mi...@apache.org> wrote:

> On 2017-11-12 16:00, Gary Gregory wrote:
>
>> On Sun, Nov 12, 2017 at 7:25 AM, Mikael Ståldal <mi...@apache.org> wrote:
>>
>> Do we want a package-info.java in the Jetty package, like in the Tomcat
>>> package?
>>>
>>> And you should probably add a section about Jetty integraion in
>>> log4j-appserver/src/site/markdown/index.md.vm
>>>
>>
>> Done. Please review.
>>
>
> I don't see anything about Jetty in log4j-appserver/src/site/markd
> own/index.md.vm
>
>

Re: logging-log4j2 git commit: [LOG4J2-2114] Provide a native Log4j 2 implementation of Eclipse Jetty's org.eclipse.jetty.util.log.Logger.

Posted by Mikael Ståldal <mi...@apache.org>.
On 2017-11-12 16:00, Gary Gregory wrote:
> On Sun, Nov 12, 2017 at 7:25 AM, Mikael Ståldal <mi...@apache.org> wrote:
> 
>> Do we want a package-info.java in the Jetty package, like in the Tomcat
>> package?
>>
>> And you should probably add a section about Jetty integraion in
>> log4j-appserver/src/site/markdown/index.md.vm
> 
> Done. Please review.

I don't see anything about Jetty in 
log4j-appserver/src/site/markdown/index.md.vm


Re: logging-log4j2 git commit: [LOG4J2-2114] Provide a native Log4j 2 implementation of Eclipse Jetty's org.eclipse.jetty.util.log.Logger.

Posted by Gary Gregory <ga...@gmail.com>.
On Sun, Nov 12, 2017 at 7:25 AM, Mikael Ståldal <mi...@apache.org> wrote:

> Do we want a package-info.java in the Jetty package, like in the Tomcat
> package?
>
> And you should probably add a section about Jetty integraion in
> log4j-appserver/src/site/markdown/index.md.vm


Done. Please review.

Gary


>
>
>
> On 2017-11-11 23:43, Gary Gregory wrote:
>
>> Please code review git master. I'm not sure I have the class loader right.
>>
>> Gary
>>
>> On Sat, Nov 11, 2017 at 2:54 PM, Ralph Goers <ra...@dslextreme.com>
>> wrote:
>>
>> Oh, but you probably don’t want to extend AbstractLogger. You really want
>>> the FQCN of the caller to be able to identify the ClassLoader and
>>> LoggerContext to use and you won’t get that from AbstractLogger’s
>>> getLogger
>>> method.
>>>
>>> Ralph
>>>
>>> On Nov 11, 2017, at 2:45 PM, Ralph Goers <ra...@dslextreme.com>
>>>>
>>> wrote:
>>>
>>>>
>>>> Sure. Look at TomcatLogger. It does exactly what you are trying to do.
>>>>
>>>> Ralph
>>>>
>>>> On Nov 11, 2017, at 2:02 PM, Gary Gregory <ga...@gmail.com>
>>>>>
>>>> wrote:
>>>
>>>>
>>>>> The Javadoc for Log4j's LoggerAdapter says "This registry should not be
>>>>> used for Log4j Loggers; it is instead used for creating bridges to
>>>>> other
>>>>> external log systems.".
>>>>>
>>>>> In this case we are not bridging TO another log system. We are plugging
>>>>> INTO Jetty's log system and subclassing Jetty's own LoggerAdapter class
>>>>> (out convenience.)
>>>>>
>>>>> Further thoughts?
>>>>>
>>>>> Gary
>>>>>
>>>>> On Fri, Nov 10, 2017 at 9:25 PM, Matt Sicker <bo...@gmail.com> wrote:
>>>>>
>>>>> IIRC, the easiest way to support it might be to use
>>>>>> https://logging.apache.org/log4j/2.x/log4j-api/apidocs/
>>>>>> org/apache/logging/log4j/spi/AbstractLoggerAdapter.html
>>>>>>
>>>>>> On 10 November 2017 at 22:16, Gary Gregory <ga...@gmail.com>
>>>>>>
>>>>> wrote:
>>>
>>>>
>>>>>> I think you are correct...
>>>>>>>
>>>>>>> Gary
>>>>>>>
>>>>>>> On Fri, Nov 10, 2017 at 6:59 PM, Matt Sicker <bo...@gmail.com>
>>>>>>>
>>>>>> wrote:
>>>
>>>>
>>>>>>> Wouldn't this implementation contain incorrect caller location
>>>>>>>>
>>>>>>> information?
>>>>>>>
>>>>>>>>
>>>>>>>> On 10 November 2017 at 19:25, <gg...@apache.org> wrote:
>>>>>>>>
>>>>>>>> Repository: logging-log4j2
>>>>>>>>> Updated Branches:
>>>>>>>>> refs/heads/master aad2f132b -> 7d52f131e
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> [LOG4J2-2114] Provide a native Log4j 2 implementation of Eclipse
>>>>>>>>>
>>>>>>>> Jetty's
>>>>>>>
>>>>>>>> org.eclipse.jetty.util.log.Logger.
>>>>>>>>>
>>>>>>>>> Project: http://git-wip-us.apache.org/r
>>>>>>>>> epos/asf/logging-log4j2/repo
>>>>>>>>> Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/
>>>>>>>>> commit/7d52f131
>>>>>>>>> Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/
>>>>>>>>>
>>>>>>>> 7d52f131
>>>>>>>>
>>>>>>>>> Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/
>>>>>>>>>
>>>>>>>> 7d52f131
>>>>>>>>
>>>>>>>>>
>>>>>>>>> Branch: refs/heads/master
>>>>>>>>> Commit: 7d52f131ec1e000834bcb40343f3f2d41805c75a
>>>>>>>>> Parents: aad2f13
>>>>>>>>> Author: Gary Gregory <gg...@apache.org>
>>>>>>>>> Authored: Fri Nov 10 18:25:47 2017 -0700
>>>>>>>>> Committer: Gary Gregory <gg...@apache.org>
>>>>>>>>> Committed: Fri Nov 10 18:25:47 2017 -0700
>>>>>>>>>
>>>>>>>>> ------------------------------------------------------------
>>>>>>>>>
>>>>>>>> ----------
>>>>>>
>>>>>>> log4j-appserver/pom.xml                         |   8 +
>>>>>>>>> .../log4j/appserver/jetty/Log4j2Logger.java     | 184
>>>>>>>>>
>>>>>>>> +++++++++++++++++++
>>>>>>>>
>>>>>>>>> src/changes/changes.xml                         |   3 +
>>>>>>>>> 3 files changed, 195 insertions(+)
>>>>>>>>> ------------------------------------------------------------
>>>>>>>>>
>>>>>>>> ----------
>>>>>>
>>>>>>>
>>>>>>>>>
>>>>>>>>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
>>>>>>>>> 7d52f131/log4j-appserver/pom.xml
>>>>>>>>> ------------------------------------------------------------
>>>>>>>>>
>>>>>>>> ----------
>>>>>>
>>>>>>> diff --git a/log4j-appserver/pom.xml b/log4j-appserver/pom.xml
>>>>>>>>> index e96b1fc..6acd77b 100644
>>>>>>>>> --- a/log4j-appserver/pom.xml
>>>>>>>>> +++ b/log4j-appserver/pom.xml
>>>>>>>>> @@ -34,6 +34,7 @@
>>>>>>>>>     <docLabel>Web Documentation</docLabel>
>>>>>>>>>     <projectDir>/log4j-appserver</projectDir>
>>>>>>>>>     <tomcat.version>8.5.20</tomcat.version>
>>>>>>>>> +    <jetty.version>8.2.0.v20160908</jetty.version> <!--  Jetty 9
>>>>>>>>> requires Java 8 -->
>>>>>>>>>     <module.name>org.apache.logging.log4j.appserver</module.name>
>>>>>>>>>   </properties>
>>>>>>>>>
>>>>>>>>> @@ -56,6 +57,7 @@
>>>>>>>>>       <groupId>org.apache.tomcat</groupId>
>>>>>>>>>       <artifactId>tomcat-catalina</artifactId>
>>>>>>>>>       <version>${tomcat.version}</version>
>>>>>>>>> +      <scope>provided</scope>
>>>>>>>>>       <exclusions>
>>>>>>>>>         <exclusion>
>>>>>>>>>           <groupId>org.apache.tomcat</groupId>
>>>>>>>>> @@ -71,6 +73,12 @@
>>>>>>>>>         </exclusion>
>>>>>>>>>       </exclusions>
>>>>>>>>>     </dependency>
>>>>>>>>> +    <dependency>
>>>>>>>>> +      <groupId>org.eclipse.jetty</groupId>
>>>>>>>>> +      <artifactId>jetty-util</artifactId>
>>>>>>>>> +      <version>${jetty.version}</version>
>>>>>>>>> +      <scope>provided</scope>
>>>>>>>>> +    </dependency>
>>>>>>>>>
>>>>>>>>>     <!-- Test dependencies -->
>>>>>>>>>     <dependency>
>>>>>>>>>
>>>>>>>>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
>>>>>>>>> 7d52f131/log4j-appserver/src/main/java/org/apache/logging/
>>>>>>>>> log4j/appserver/jetty/Log4j2Logger.java
>>>>>>>>> ------------------------------------------------------------
>>>>>>>>>
>>>>>>>> ----------
>>>>>>
>>>>>>> diff --git a/log4j-appserver/src/main/
>>>>>>>>>
>>>>>>>> java/org/apache/logging/log4j/
>>>
>>>> appserver/jetty/Log4j2Logger.java b/log4j-appserver/src/main/
>>>>>>>>> java/org/apache/logging/log4j/appserver/jetty/Log4j2Logger.java
>>>>>>>>> new file mode 100644
>>>>>>>>> index 0000000..7d1ce14
>>>>>>>>> --- /dev/null
>>>>>>>>> +++ b/log4j-appserver/src/main/java/org/apache/logging/log4j/
>>>>>>>>> appserver/jetty/Log4j2Logger.java
>>>>>>>>> @@ -0,0 +1,184 @@
>>>>>>>>> +/*
>>>>>>>>> + * Licensed to the Apache Software Foundation (ASF) under one or
>>>>>>>>>
>>>>>>>> more
>>>>>>
>>>>>>> + * contributor license agreements. See the NOTICE file distributed
>>>>>>>>>
>>>>>>>> with
>>>>>>>
>>>>>>>> + * this work for additional information regarding copyright
>>>>>>>>>
>>>>>>>> ownership.
>>>>>>
>>>>>>> + * The ASF licenses this file to You under the Apache license,
>>>>>>>>>
>>>>>>>> Version
>>>>>>
>>>>>>> 2.0
>>>>>>>>
>>>>>>>>> + * (the "License"); you may not use this file except in compliance
>>>>>>>>>
>>>>>>>> with
>>>>>>>
>>>>>>>> + * the License. You may obtain a copy of the License at
>>>>>>>>> + *
>>>>>>>>> + *      http://www.apache.org/licenses/LICENSE-2.0
>>>>>>>>> + *
>>>>>>>>> + * Unless required by applicable law or agreed to in writing,
>>>>>>>>>
>>>>>>>> software
>>>>>>
>>>>>>> + * distributed under the License is distributed on an "AS IS"
>>>>>>>>>
>>>>>>>> BASIS,
>>>
>>>> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>>>>>>>>> implied.
>>>>>>>>> + * See the license for the specific language governing permissions
>>>>>>>>>
>>>>>>>> and
>>>>>>
>>>>>>> + * limitations under the license.
>>>>>>>>> + */
>>>>>>>>> +
>>>>>>>>> +package org.apache.logging.log4j.appserver.jetty;
>>>>>>>>> +
>>>>>>>>> +import org.apache.logging.log4j.LogManager;
>>>>>>>>> +import org.eclipse.jetty.util.log.AbstractLogger;
>>>>>>>>> +import org.eclipse.jetty.util.log.Logger;
>>>>>>>>> +
>>>>>>>>> +/**
>>>>>>>>> + * Provides a native Apache Log4j 2 for Jetty logging.
>>>>>>>>> + */
>>>>>>>>> +public class Log4j2Logger extends AbstractLogger {
>>>>>>>>> +
>>>>>>>>> +    private final org.apache.logging.log4j.Logger logger;
>>>>>>>>> +
>>>>>>>>> +    private final String name;
>>>>>>>>> +
>>>>>>>>> +    public Log4j2Logger(final String name) {
>>>>>>>>> +        super();
>>>>>>>>> +        this.name = name;
>>>>>>>>> +        this.logger = LogManager.getLogger(name);
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    public Log4j2Logger() {
>>>>>>>>> +        this("");
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    /*
>>>>>>>>> +     * (non-Javadoc)
>>>>>>>>> +     *
>>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>>>>>>>>>
>>>>>>>> Logger#debug(java.lang.String,
>>>>>>
>>>>>>> java.lang.Object[])
>>>>>>>>> +     */
>>>>>>>>> +    @Override
>>>>>>>>> +    public void debug(final String msg, final Object... args) {
>>>>>>>>> +        logger.debug(msg, args);
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    /*
>>>>>>>>> +     * (non-Javadoc)
>>>>>>>>> +     *
>>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>>>>>>>>>
>>>>>>>> Logger#debug(java.lang.String,
>>>>>>
>>>>>>> java.lang.Throwable)
>>>>>>>>> +     */
>>>>>>>>> +    @Override
>>>>>>>>> +    public void debug(final String msg, final Throwable thrown) {
>>>>>>>>> +        logger.debug(msg, thrown);
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    /*
>>>>>>>>> +     * (non-Javadoc)
>>>>>>>>> +     *
>>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#debug(java.lang.
>>>>>>>>>
>>>>>>>> Throwable)
>>>>>>>>
>>>>>>>>> +     */
>>>>>>>>> +    @Override
>>>>>>>>> +    public void debug(final Throwable thrown) {
>>>>>>>>> +        logger.debug(thrown);
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    /*
>>>>>>>>> +     * (non-Javadoc)
>>>>>>>>> +     *
>>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#getName()
>>>>>>>>> +     */
>>>>>>>>> +    @Override
>>>>>>>>> +    public String getName() {
>>>>>>>>> +        return name;
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    /*
>>>>>>>>> +     * (non-Javadoc)
>>>>>>>>> +     *
>>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#ignore(java.lang.
>>>>>>>>>
>>>>>>>> Throwable)
>>>>>>>>
>>>>>>>>> +     */
>>>>>>>>> +    @Override
>>>>>>>>> +    public void ignore(final Throwable ignored) {
>>>>>>>>> +        // TODO Auto-generated method stub
>>>>>>>>> +
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    /*
>>>>>>>>> +     * (non-Javadoc)
>>>>>>>>> +     *
>>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>>>>>>>>>
>>>>>>>> Logger#info(java.lang.String,
>>>>>>
>>>>>>> java.lang.Object[])
>>>>>>>>> +     */
>>>>>>>>> +    @Override
>>>>>>>>> +    public void info(final String msg, final Object... args) {
>>>>>>>>> +        logger.info(msg, args);
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    /*
>>>>>>>>> +     * (non-Javadoc)
>>>>>>>>> +     *
>>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>>>>>>>>>
>>>>>>>> Logger#info(java.lang.String,
>>>>>>
>>>>>>> java.lang.Throwable)
>>>>>>>>> +     */
>>>>>>>>> +    @Override
>>>>>>>>> +    public void info(final String msg, final Throwable thrown) {
>>>>>>>>> +        logger.info(msg, thrown);
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    /*
>>>>>>>>> +     * (non-Javadoc)
>>>>>>>>> +     *
>>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#info(java.lang.
>>>>>>>>>
>>>>>>>> Throwable)
>>>>>>>
>>>>>>>> +     */
>>>>>>>>> +    @Override
>>>>>>>>> +    public void info(final Throwable thrown) {
>>>>>>>>> +        logger.info(thrown);
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    /*
>>>>>>>>> +     * (non-Javadoc)
>>>>>>>>> +     *
>>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#isDebugEnabled()
>>>>>>>>> +     */
>>>>>>>>> +    @Override
>>>>>>>>> +    public boolean isDebugEnabled() {
>>>>>>>>> +        return logger.isDebugEnabled();
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    /*
>>>>>>>>> +     * (non-Javadoc)
>>>>>>>>> +     *
>>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>>>>>>>>>
>>>>>>>> AbstractLogger#newLogger(java.
>>>>>>
>>>>>>> lang.String)
>>>>>>>>> +     */
>>>>>>>>> +    @Override
>>>>>>>>> +    protected Logger newLogger(final String fullname) {
>>>>>>>>> +        return new Log4j2Logger(fullname);
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    /*
>>>>>>>>> +     * (non-Javadoc)
>>>>>>>>> +     *
>>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#setDebugEnabled(
>>>>>>>>>
>>>>>>>> boolean)
>>>>>>>
>>>>>>>> +     */
>>>>>>>>> +    @Override
>>>>>>>>> +    public void setDebugEnabled(final boolean enabled) {
>>>>>>>>> +        warn("setDebugEnabled not implemented");
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    /*
>>>>>>>>> +     * (non-Javadoc)
>>>>>>>>> +     *
>>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>>>>>>>>>
>>>>>>>> Logger#warn(java.lang.String,
>>>>>>
>>>>>>> java.lang.Object[])
>>>>>>>>> +     */
>>>>>>>>> +    @Override
>>>>>>>>> +    public void warn(final String msg, final Object... args) {
>>>>>>>>> +        logger.warn(msg, args);
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    /*
>>>>>>>>> +     * (non-Javadoc)
>>>>>>>>> +     *
>>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>>>>>>>>>
>>>>>>>> Logger#warn(java.lang.String,
>>>>>>
>>>>>>> java.lang.Throwable)
>>>>>>>>> +     */
>>>>>>>>> +    @Override
>>>>>>>>> +    public void warn(final String msg, final Throwable thrown) {
>>>>>>>>> +        logger.warn(msg, thrown);
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    /*
>>>>>>>>> +     * (non-Javadoc)
>>>>>>>>> +     *
>>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#warn(java.lang.
>>>>>>>>>
>>>>>>>> Throwable)
>>>>>>>
>>>>>>>> +     */
>>>>>>>>> +    @Override
>>>>>>>>> +    public void warn(final Throwable thrown) {
>>>>>>>>> +        logger.warn(thrown);
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +}
>>>>>>>>>
>>>>>>>>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
>>>>>>>>> 7d52f131/src/changes/changes.xml
>>>>>>>>> ------------------------------------------------------------
>>>>>>>>>
>>>>>>>> ----------
>>>>>>
>>>>>>> diff --git a/src/changes/changes.xml b/src/changes/changes.xml
>>>>>>>>> index 2bcefb2..070e4a1 100644
>>>>>>>>> --- a/src/changes/changes.xml
>>>>>>>>> +++ b/src/changes/changes.xml
>>>>>>>>> @@ -37,6 +37,9 @@
>>>>>>>>>       <action issue="LOG4J2-2103" dev="mikes" type="add">
>>>>>>>>>         XML encoding for PatternLayout.
>>>>>>>>>       </action>
>>>>>>>>> +      <action issue="LOG4J2-2114" dev="ggregory" type="add">
>>>>>>>>> +        Provide a native Log4j 2 implementation of Eclipse Jetty's
>>>>>>>>> org.eclipse.jetty.util.log.Logger.
>>>>>>>>> +      </action>
>>>>>>>>>       <action issue="LOG4J2-1203" dev="mikes" type="add"
>>>>>>>>>
>>>>>>>> due-to="Robert
>>>>>>>
>>>>>>>> Turner">
>>>>>>>>>         Allow filtering of line breaks in layout pattern.
>>>>>>>>>       </action>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Matt Sicker <bo...@gmail.com>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Matt Sicker <bo...@gmail.com>
>>>>>>
>>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>

Re: logging-log4j2 git commit: [LOG4J2-2114] Provide a native Log4j 2 implementation of Eclipse Jetty's org.eclipse.jetty.util.log.Logger.

Posted by Mikael Ståldal <mi...@apache.org>.
Do we want a package-info.java in the Jetty package, like in the Tomcat 
package?

And you should probably add a section about Jetty integraion in
log4j-appserver/src/site/markdown/index.md.vm


On 2017-11-11 23:43, Gary Gregory wrote:
> Please code review git master. I'm not sure I have the class loader right.
> 
> Gary
> 
> On Sat, Nov 11, 2017 at 2:54 PM, Ralph Goers <ra...@dslextreme.com>
> wrote:
> 
>> Oh, but you probably don’t want to extend AbstractLogger. You really want
>> the FQCN of the caller to be able to identify the ClassLoader and
>> LoggerContext to use and you won’t get that from AbstractLogger’s getLogger
>> method.
>>
>> Ralph
>>
>>> On Nov 11, 2017, at 2:45 PM, Ralph Goers <ra...@dslextreme.com>
>> wrote:
>>>
>>> Sure. Look at TomcatLogger. It does exactly what you are trying to do.
>>>
>>> Ralph
>>>
>>>> On Nov 11, 2017, at 2:02 PM, Gary Gregory <ga...@gmail.com>
>> wrote:
>>>>
>>>> The Javadoc for Log4j's LoggerAdapter says "This registry should not be
>>>> used for Log4j Loggers; it is instead used for creating bridges to other
>>>> external log systems.".
>>>>
>>>> In this case we are not bridging TO another log system. We are plugging
>>>> INTO Jetty's log system and subclassing Jetty's own LoggerAdapter class
>>>> (out convenience.)
>>>>
>>>> Further thoughts?
>>>>
>>>> Gary
>>>>
>>>> On Fri, Nov 10, 2017 at 9:25 PM, Matt Sicker <bo...@gmail.com> wrote:
>>>>
>>>>> IIRC, the easiest way to support it might be to use
>>>>> https://logging.apache.org/log4j/2.x/log4j-api/apidocs/
>>>>> org/apache/logging/log4j/spi/AbstractLoggerAdapter.html
>>>>>
>>>>> On 10 November 2017 at 22:16, Gary Gregory <ga...@gmail.com>
>> wrote:
>>>>>
>>>>>> I think you are correct...
>>>>>>
>>>>>> Gary
>>>>>>
>>>>>> On Fri, Nov 10, 2017 at 6:59 PM, Matt Sicker <bo...@gmail.com>
>> wrote:
>>>>>>
>>>>>>> Wouldn't this implementation contain incorrect caller location
>>>>>> information?
>>>>>>>
>>>>>>> On 10 November 2017 at 19:25, <gg...@apache.org> wrote:
>>>>>>>
>>>>>>>> Repository: logging-log4j2
>>>>>>>> Updated Branches:
>>>>>>>> refs/heads/master aad2f132b -> 7d52f131e
>>>>>>>>
>>>>>>>>
>>>>>>>> [LOG4J2-2114] Provide a native Log4j 2 implementation of Eclipse
>>>>>> Jetty's
>>>>>>>> org.eclipse.jetty.util.log.Logger.
>>>>>>>>
>>>>>>>> Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
>>>>>>>> Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/
>>>>>>>> commit/7d52f131
>>>>>>>> Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/
>>>>>>> 7d52f131
>>>>>>>> Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/
>>>>>>> 7d52f131
>>>>>>>>
>>>>>>>> Branch: refs/heads/master
>>>>>>>> Commit: 7d52f131ec1e000834bcb40343f3f2d41805c75a
>>>>>>>> Parents: aad2f13
>>>>>>>> Author: Gary Gregory <gg...@apache.org>
>>>>>>>> Authored: Fri Nov 10 18:25:47 2017 -0700
>>>>>>>> Committer: Gary Gregory <gg...@apache.org>
>>>>>>>> Committed: Fri Nov 10 18:25:47 2017 -0700
>>>>>>>>
>>>>>>>> ------------------------------------------------------------
>>>>> ----------
>>>>>>>> log4j-appserver/pom.xml                         |   8 +
>>>>>>>> .../log4j/appserver/jetty/Log4j2Logger.java     | 184
>>>>>>> +++++++++++++++++++
>>>>>>>> src/changes/changes.xml                         |   3 +
>>>>>>>> 3 files changed, 195 insertions(+)
>>>>>>>> ------------------------------------------------------------
>>>>> ----------
>>>>>>>>
>>>>>>>>
>>>>>>>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
>>>>>>>> 7d52f131/log4j-appserver/pom.xml
>>>>>>>> ------------------------------------------------------------
>>>>> ----------
>>>>>>>> diff --git a/log4j-appserver/pom.xml b/log4j-appserver/pom.xml
>>>>>>>> index e96b1fc..6acd77b 100644
>>>>>>>> --- a/log4j-appserver/pom.xml
>>>>>>>> +++ b/log4j-appserver/pom.xml
>>>>>>>> @@ -34,6 +34,7 @@
>>>>>>>>     <docLabel>Web Documentation</docLabel>
>>>>>>>>     <projectDir>/log4j-appserver</projectDir>
>>>>>>>>     <tomcat.version>8.5.20</tomcat.version>
>>>>>>>> +    <jetty.version>8.2.0.v20160908</jetty.version> <!--  Jetty 9
>>>>>>>> requires Java 8 -->
>>>>>>>>     <module.name>org.apache.logging.log4j.appserver</module.name>
>>>>>>>>   </properties>
>>>>>>>>
>>>>>>>> @@ -56,6 +57,7 @@
>>>>>>>>       <groupId>org.apache.tomcat</groupId>
>>>>>>>>       <artifactId>tomcat-catalina</artifactId>
>>>>>>>>       <version>${tomcat.version}</version>
>>>>>>>> +      <scope>provided</scope>
>>>>>>>>       <exclusions>
>>>>>>>>         <exclusion>
>>>>>>>>           <groupId>org.apache.tomcat</groupId>
>>>>>>>> @@ -71,6 +73,12 @@
>>>>>>>>         </exclusion>
>>>>>>>>       </exclusions>
>>>>>>>>     </dependency>
>>>>>>>> +    <dependency>
>>>>>>>> +      <groupId>org.eclipse.jetty</groupId>
>>>>>>>> +      <artifactId>jetty-util</artifactId>
>>>>>>>> +      <version>${jetty.version}</version>
>>>>>>>> +      <scope>provided</scope>
>>>>>>>> +    </dependency>
>>>>>>>>
>>>>>>>>     <!-- Test dependencies -->
>>>>>>>>     <dependency>
>>>>>>>>
>>>>>>>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
>>>>>>>> 7d52f131/log4j-appserver/src/main/java/org/apache/logging/
>>>>>>>> log4j/appserver/jetty/Log4j2Logger.java
>>>>>>>> ------------------------------------------------------------
>>>>> ----------
>>>>>>>> diff --git a/log4j-appserver/src/main/
>> java/org/apache/logging/log4j/
>>>>>>>> appserver/jetty/Log4j2Logger.java b/log4j-appserver/src/main/
>>>>>>>> java/org/apache/logging/log4j/appserver/jetty/Log4j2Logger.java
>>>>>>>> new file mode 100644
>>>>>>>> index 0000000..7d1ce14
>>>>>>>> --- /dev/null
>>>>>>>> +++ b/log4j-appserver/src/main/java/org/apache/logging/log4j/
>>>>>>>> appserver/jetty/Log4j2Logger.java
>>>>>>>> @@ -0,0 +1,184 @@
>>>>>>>> +/*
>>>>>>>> + * Licensed to the Apache Software Foundation (ASF) under one or
>>>>> more
>>>>>>>> + * contributor license agreements. See the NOTICE file distributed
>>>>>> with
>>>>>>>> + * this work for additional information regarding copyright
>>>>> ownership.
>>>>>>>> + * The ASF licenses this file to You under the Apache license,
>>>>> Version
>>>>>>> 2.0
>>>>>>>> + * (the "License"); you may not use this file except in compliance
>>>>>> with
>>>>>>>> + * the License. You may obtain a copy of the License at
>>>>>>>> + *
>>>>>>>> + *      http://www.apache.org/licenses/LICENSE-2.0
>>>>>>>> + *
>>>>>>>> + * Unless required by applicable law or agreed to in writing,
>>>>> software
>>>>>>>> + * distributed under the License is distributed on an "AS IS"
>> BASIS,
>>>>>>>> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>>>>>>>> implied.
>>>>>>>> + * See the license for the specific language governing permissions
>>>>> and
>>>>>>>> + * limitations under the license.
>>>>>>>> + */
>>>>>>>> +
>>>>>>>> +package org.apache.logging.log4j.appserver.jetty;
>>>>>>>> +
>>>>>>>> +import org.apache.logging.log4j.LogManager;
>>>>>>>> +import org.eclipse.jetty.util.log.AbstractLogger;
>>>>>>>> +import org.eclipse.jetty.util.log.Logger;
>>>>>>>> +
>>>>>>>> +/**
>>>>>>>> + * Provides a native Apache Log4j 2 for Jetty logging.
>>>>>>>> + */
>>>>>>>> +public class Log4j2Logger extends AbstractLogger {
>>>>>>>> +
>>>>>>>> +    private final org.apache.logging.log4j.Logger logger;
>>>>>>>> +
>>>>>>>> +    private final String name;
>>>>>>>> +
>>>>>>>> +    public Log4j2Logger(final String name) {
>>>>>>>> +        super();
>>>>>>>> +        this.name = name;
>>>>>>>> +        this.logger = LogManager.getLogger(name);
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    public Log4j2Logger() {
>>>>>>>> +        this("");
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    /*
>>>>>>>> +     * (non-Javadoc)
>>>>>>>> +     *
>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>>>>> Logger#debug(java.lang.String,
>>>>>>>> java.lang.Object[])
>>>>>>>> +     */
>>>>>>>> +    @Override
>>>>>>>> +    public void debug(final String msg, final Object... args) {
>>>>>>>> +        logger.debug(msg, args);
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    /*
>>>>>>>> +     * (non-Javadoc)
>>>>>>>> +     *
>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>>>>> Logger#debug(java.lang.String,
>>>>>>>> java.lang.Throwable)
>>>>>>>> +     */
>>>>>>>> +    @Override
>>>>>>>> +    public void debug(final String msg, final Throwable thrown) {
>>>>>>>> +        logger.debug(msg, thrown);
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    /*
>>>>>>>> +     * (non-Javadoc)
>>>>>>>> +     *
>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#debug(java.lang.
>>>>>>> Throwable)
>>>>>>>> +     */
>>>>>>>> +    @Override
>>>>>>>> +    public void debug(final Throwable thrown) {
>>>>>>>> +        logger.debug(thrown);
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    /*
>>>>>>>> +     * (non-Javadoc)
>>>>>>>> +     *
>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#getName()
>>>>>>>> +     */
>>>>>>>> +    @Override
>>>>>>>> +    public String getName() {
>>>>>>>> +        return name;
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    /*
>>>>>>>> +     * (non-Javadoc)
>>>>>>>> +     *
>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#ignore(java.lang.
>>>>>>> Throwable)
>>>>>>>> +     */
>>>>>>>> +    @Override
>>>>>>>> +    public void ignore(final Throwable ignored) {
>>>>>>>> +        // TODO Auto-generated method stub
>>>>>>>> +
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    /*
>>>>>>>> +     * (non-Javadoc)
>>>>>>>> +     *
>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>>>>> Logger#info(java.lang.String,
>>>>>>>> java.lang.Object[])
>>>>>>>> +     */
>>>>>>>> +    @Override
>>>>>>>> +    public void info(final String msg, final Object... args) {
>>>>>>>> +        logger.info(msg, args);
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    /*
>>>>>>>> +     * (non-Javadoc)
>>>>>>>> +     *
>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>>>>> Logger#info(java.lang.String,
>>>>>>>> java.lang.Throwable)
>>>>>>>> +     */
>>>>>>>> +    @Override
>>>>>>>> +    public void info(final String msg, final Throwable thrown) {
>>>>>>>> +        logger.info(msg, thrown);
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    /*
>>>>>>>> +     * (non-Javadoc)
>>>>>>>> +     *
>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#info(java.lang.
>>>>>> Throwable)
>>>>>>>> +     */
>>>>>>>> +    @Override
>>>>>>>> +    public void info(final Throwable thrown) {
>>>>>>>> +        logger.info(thrown);
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    /*
>>>>>>>> +     * (non-Javadoc)
>>>>>>>> +     *
>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#isDebugEnabled()
>>>>>>>> +     */
>>>>>>>> +    @Override
>>>>>>>> +    public boolean isDebugEnabled() {
>>>>>>>> +        return logger.isDebugEnabled();
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    /*
>>>>>>>> +     * (non-Javadoc)
>>>>>>>> +     *
>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>>>>> AbstractLogger#newLogger(java.
>>>>>>>> lang.String)
>>>>>>>> +     */
>>>>>>>> +    @Override
>>>>>>>> +    protected Logger newLogger(final String fullname) {
>>>>>>>> +        return new Log4j2Logger(fullname);
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    /*
>>>>>>>> +     * (non-Javadoc)
>>>>>>>> +     *
>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#setDebugEnabled(
>>>>>> boolean)
>>>>>>>> +     */
>>>>>>>> +    @Override
>>>>>>>> +    public void setDebugEnabled(final boolean enabled) {
>>>>>>>> +        warn("setDebugEnabled not implemented");
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    /*
>>>>>>>> +     * (non-Javadoc)
>>>>>>>> +     *
>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>>>>> Logger#warn(java.lang.String,
>>>>>>>> java.lang.Object[])
>>>>>>>> +     */
>>>>>>>> +    @Override
>>>>>>>> +    public void warn(final String msg, final Object... args) {
>>>>>>>> +        logger.warn(msg, args);
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    /*
>>>>>>>> +     * (non-Javadoc)
>>>>>>>> +     *
>>>>>>>> +     * @see org.eclipse.jetty.util.log.
>>>>> Logger#warn(java.lang.String,
>>>>>>>> java.lang.Throwable)
>>>>>>>> +     */
>>>>>>>> +    @Override
>>>>>>>> +    public void warn(final String msg, final Throwable thrown) {
>>>>>>>> +        logger.warn(msg, thrown);
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +    /*
>>>>>>>> +     * (non-Javadoc)
>>>>>>>> +     *
>>>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#warn(java.lang.
>>>>>> Throwable)
>>>>>>>> +     */
>>>>>>>> +    @Override
>>>>>>>> +    public void warn(final Throwable thrown) {
>>>>>>>> +        logger.warn(thrown);
>>>>>>>> +    }
>>>>>>>> +
>>>>>>>> +}
>>>>>>>>
>>>>>>>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
>>>>>>>> 7d52f131/src/changes/changes.xml
>>>>>>>> ------------------------------------------------------------
>>>>> ----------
>>>>>>>> diff --git a/src/changes/changes.xml b/src/changes/changes.xml
>>>>>>>> index 2bcefb2..070e4a1 100644
>>>>>>>> --- a/src/changes/changes.xml
>>>>>>>> +++ b/src/changes/changes.xml
>>>>>>>> @@ -37,6 +37,9 @@
>>>>>>>>       <action issue="LOG4J2-2103" dev="mikes" type="add">
>>>>>>>>         XML encoding for PatternLayout.
>>>>>>>>       </action>
>>>>>>>> +      <action issue="LOG4J2-2114" dev="ggregory" type="add">
>>>>>>>> +        Provide a native Log4j 2 implementation of Eclipse Jetty's
>>>>>>>> org.eclipse.jetty.util.log.Logger.
>>>>>>>> +      </action>
>>>>>>>>       <action issue="LOG4J2-1203" dev="mikes" type="add"
>>>>>> due-to="Robert
>>>>>>>> Turner">
>>>>>>>>         Allow filtering of line breaks in layout pattern.
>>>>>>>>       </action>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Matt Sicker <bo...@gmail.com>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Matt Sicker <bo...@gmail.com>
>>>>>
>>>
>>>
>>>
>>
>>
>>
> 


Re: logging-log4j2 git commit: [LOG4J2-2114] Provide a native Log4j 2 implementation of Eclipse Jetty's org.eclipse.jetty.util.log.Logger.

Posted by Gary Gregory <ga...@gmail.com>.
Please code review git master. I'm not sure I have the class loader right.

Gary

On Sat, Nov 11, 2017 at 2:54 PM, Ralph Goers <ra...@dslextreme.com>
wrote:

> Oh, but you probably don’t want to extend AbstractLogger. You really want
> the FQCN of the caller to be able to identify the ClassLoader and
> LoggerContext to use and you won’t get that from AbstractLogger’s getLogger
> method.
>
> Ralph
>
> > On Nov 11, 2017, at 2:45 PM, Ralph Goers <ra...@dslextreme.com>
> wrote:
> >
> > Sure. Look at TomcatLogger. It does exactly what you are trying to do.
> >
> > Ralph
> >
> >> On Nov 11, 2017, at 2:02 PM, Gary Gregory <ga...@gmail.com>
> wrote:
> >>
> >> The Javadoc for Log4j's LoggerAdapter says "This registry should not be
> >> used for Log4j Loggers; it is instead used for creating bridges to other
> >> external log systems.".
> >>
> >> In this case we are not bridging TO another log system. We are plugging
> >> INTO Jetty's log system and subclassing Jetty's own LoggerAdapter class
> >> (out convenience.)
> >>
> >> Further thoughts?
> >>
> >> Gary
> >>
> >> On Fri, Nov 10, 2017 at 9:25 PM, Matt Sicker <bo...@gmail.com> wrote:
> >>
> >>> IIRC, the easiest way to support it might be to use
> >>> https://logging.apache.org/log4j/2.x/log4j-api/apidocs/
> >>> org/apache/logging/log4j/spi/AbstractLoggerAdapter.html
> >>>
> >>> On 10 November 2017 at 22:16, Gary Gregory <ga...@gmail.com>
> wrote:
> >>>
> >>>> I think you are correct...
> >>>>
> >>>> Gary
> >>>>
> >>>> On Fri, Nov 10, 2017 at 6:59 PM, Matt Sicker <bo...@gmail.com>
> wrote:
> >>>>
> >>>>> Wouldn't this implementation contain incorrect caller location
> >>>> information?
> >>>>>
> >>>>> On 10 November 2017 at 19:25, <gg...@apache.org> wrote:
> >>>>>
> >>>>>> Repository: logging-log4j2
> >>>>>> Updated Branches:
> >>>>>> refs/heads/master aad2f132b -> 7d52f131e
> >>>>>>
> >>>>>>
> >>>>>> [LOG4J2-2114] Provide a native Log4j 2 implementation of Eclipse
> >>>> Jetty's
> >>>>>> org.eclipse.jetty.util.log.Logger.
> >>>>>>
> >>>>>> Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
> >>>>>> Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/
> >>>>>> commit/7d52f131
> >>>>>> Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/
> >>>>> 7d52f131
> >>>>>> Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/
> >>>>> 7d52f131
> >>>>>>
> >>>>>> Branch: refs/heads/master
> >>>>>> Commit: 7d52f131ec1e000834bcb40343f3f2d41805c75a
> >>>>>> Parents: aad2f13
> >>>>>> Author: Gary Gregory <gg...@apache.org>
> >>>>>> Authored: Fri Nov 10 18:25:47 2017 -0700
> >>>>>> Committer: Gary Gregory <gg...@apache.org>
> >>>>>> Committed: Fri Nov 10 18:25:47 2017 -0700
> >>>>>>
> >>>>>> ------------------------------------------------------------
> >>> ----------
> >>>>>> log4j-appserver/pom.xml                         |   8 +
> >>>>>> .../log4j/appserver/jetty/Log4j2Logger.java     | 184
> >>>>> +++++++++++++++++++
> >>>>>> src/changes/changes.xml                         |   3 +
> >>>>>> 3 files changed, 195 insertions(+)
> >>>>>> ------------------------------------------------------------
> >>> ----------
> >>>>>>
> >>>>>>
> >>>>>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> >>>>>> 7d52f131/log4j-appserver/pom.xml
> >>>>>> ------------------------------------------------------------
> >>> ----------
> >>>>>> diff --git a/log4j-appserver/pom.xml b/log4j-appserver/pom.xml
> >>>>>> index e96b1fc..6acd77b 100644
> >>>>>> --- a/log4j-appserver/pom.xml
> >>>>>> +++ b/log4j-appserver/pom.xml
> >>>>>> @@ -34,6 +34,7 @@
> >>>>>>    <docLabel>Web Documentation</docLabel>
> >>>>>>    <projectDir>/log4j-appserver</projectDir>
> >>>>>>    <tomcat.version>8.5.20</tomcat.version>
> >>>>>> +    <jetty.version>8.2.0.v20160908</jetty.version> <!--  Jetty 9
> >>>>>> requires Java 8 -->
> >>>>>>    <module.name>org.apache.logging.log4j.appserver</module.name>
> >>>>>>  </properties>
> >>>>>>
> >>>>>> @@ -56,6 +57,7 @@
> >>>>>>      <groupId>org.apache.tomcat</groupId>
> >>>>>>      <artifactId>tomcat-catalina</artifactId>
> >>>>>>      <version>${tomcat.version}</version>
> >>>>>> +      <scope>provided</scope>
> >>>>>>      <exclusions>
> >>>>>>        <exclusion>
> >>>>>>          <groupId>org.apache.tomcat</groupId>
> >>>>>> @@ -71,6 +73,12 @@
> >>>>>>        </exclusion>
> >>>>>>      </exclusions>
> >>>>>>    </dependency>
> >>>>>> +    <dependency>
> >>>>>> +      <groupId>org.eclipse.jetty</groupId>
> >>>>>> +      <artifactId>jetty-util</artifactId>
> >>>>>> +      <version>${jetty.version}</version>
> >>>>>> +      <scope>provided</scope>
> >>>>>> +    </dependency>
> >>>>>>
> >>>>>>    <!-- Test dependencies -->
> >>>>>>    <dependency>
> >>>>>>
> >>>>>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> >>>>>> 7d52f131/log4j-appserver/src/main/java/org/apache/logging/
> >>>>>> log4j/appserver/jetty/Log4j2Logger.java
> >>>>>> ------------------------------------------------------------
> >>> ----------
> >>>>>> diff --git a/log4j-appserver/src/main/
> java/org/apache/logging/log4j/
> >>>>>> appserver/jetty/Log4j2Logger.java b/log4j-appserver/src/main/
> >>>>>> java/org/apache/logging/log4j/appserver/jetty/Log4j2Logger.java
> >>>>>> new file mode 100644
> >>>>>> index 0000000..7d1ce14
> >>>>>> --- /dev/null
> >>>>>> +++ b/log4j-appserver/src/main/java/org/apache/logging/log4j/
> >>>>>> appserver/jetty/Log4j2Logger.java
> >>>>>> @@ -0,0 +1,184 @@
> >>>>>> +/*
> >>>>>> + * Licensed to the Apache Software Foundation (ASF) under one or
> >>> more
> >>>>>> + * contributor license agreements. See the NOTICE file distributed
> >>>> with
> >>>>>> + * this work for additional information regarding copyright
> >>> ownership.
> >>>>>> + * The ASF licenses this file to You under the Apache license,
> >>> Version
> >>>>> 2.0
> >>>>>> + * (the "License"); you may not use this file except in compliance
> >>>> with
> >>>>>> + * the License. You may obtain a copy of the License at
> >>>>>> + *
> >>>>>> + *      http://www.apache.org/licenses/LICENSE-2.0
> >>>>>> + *
> >>>>>> + * Unless required by applicable law or agreed to in writing,
> >>> software
> >>>>>> + * distributed under the License is distributed on an "AS IS"
> BASIS,
> >>>>>> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> >>>>>> implied.
> >>>>>> + * See the license for the specific language governing permissions
> >>> and
> >>>>>> + * limitations under the license.
> >>>>>> + */
> >>>>>> +
> >>>>>> +package org.apache.logging.log4j.appserver.jetty;
> >>>>>> +
> >>>>>> +import org.apache.logging.log4j.LogManager;
> >>>>>> +import org.eclipse.jetty.util.log.AbstractLogger;
> >>>>>> +import org.eclipse.jetty.util.log.Logger;
> >>>>>> +
> >>>>>> +/**
> >>>>>> + * Provides a native Apache Log4j 2 for Jetty logging.
> >>>>>> + */
> >>>>>> +public class Log4j2Logger extends AbstractLogger {
> >>>>>> +
> >>>>>> +    private final org.apache.logging.log4j.Logger logger;
> >>>>>> +
> >>>>>> +    private final String name;
> >>>>>> +
> >>>>>> +    public Log4j2Logger(final String name) {
> >>>>>> +        super();
> >>>>>> +        this.name = name;
> >>>>>> +        this.logger = LogManager.getLogger(name);
> >>>>>> +    }
> >>>>>> +
> >>>>>> +    public Log4j2Logger() {
> >>>>>> +        this("");
> >>>>>> +    }
> >>>>>> +
> >>>>>> +    /*
> >>>>>> +     * (non-Javadoc)
> >>>>>> +     *
> >>>>>> +     * @see org.eclipse.jetty.util.log.
> >>> Logger#debug(java.lang.String,
> >>>>>> java.lang.Object[])
> >>>>>> +     */
> >>>>>> +    @Override
> >>>>>> +    public void debug(final String msg, final Object... args) {
> >>>>>> +        logger.debug(msg, args);
> >>>>>> +    }
> >>>>>> +
> >>>>>> +    /*
> >>>>>> +     * (non-Javadoc)
> >>>>>> +     *
> >>>>>> +     * @see org.eclipse.jetty.util.log.
> >>> Logger#debug(java.lang.String,
> >>>>>> java.lang.Throwable)
> >>>>>> +     */
> >>>>>> +    @Override
> >>>>>> +    public void debug(final String msg, final Throwable thrown) {
> >>>>>> +        logger.debug(msg, thrown);
> >>>>>> +    }
> >>>>>> +
> >>>>>> +    /*
> >>>>>> +     * (non-Javadoc)
> >>>>>> +     *
> >>>>>> +     * @see org.eclipse.jetty.util.log.Logger#debug(java.lang.
> >>>>> Throwable)
> >>>>>> +     */
> >>>>>> +    @Override
> >>>>>> +    public void debug(final Throwable thrown) {
> >>>>>> +        logger.debug(thrown);
> >>>>>> +    }
> >>>>>> +
> >>>>>> +    /*
> >>>>>> +     * (non-Javadoc)
> >>>>>> +     *
> >>>>>> +     * @see org.eclipse.jetty.util.log.Logger#getName()
> >>>>>> +     */
> >>>>>> +    @Override
> >>>>>> +    public String getName() {
> >>>>>> +        return name;
> >>>>>> +    }
> >>>>>> +
> >>>>>> +    /*
> >>>>>> +     * (non-Javadoc)
> >>>>>> +     *
> >>>>>> +     * @see org.eclipse.jetty.util.log.Logger#ignore(java.lang.
> >>>>> Throwable)
> >>>>>> +     */
> >>>>>> +    @Override
> >>>>>> +    public void ignore(final Throwable ignored) {
> >>>>>> +        // TODO Auto-generated method stub
> >>>>>> +
> >>>>>> +    }
> >>>>>> +
> >>>>>> +    /*
> >>>>>> +     * (non-Javadoc)
> >>>>>> +     *
> >>>>>> +     * @see org.eclipse.jetty.util.log.
> >>> Logger#info(java.lang.String,
> >>>>>> java.lang.Object[])
> >>>>>> +     */
> >>>>>> +    @Override
> >>>>>> +    public void info(final String msg, final Object... args) {
> >>>>>> +        logger.info(msg, args);
> >>>>>> +    }
> >>>>>> +
> >>>>>> +    /*
> >>>>>> +     * (non-Javadoc)
> >>>>>> +     *
> >>>>>> +     * @see org.eclipse.jetty.util.log.
> >>> Logger#info(java.lang.String,
> >>>>>> java.lang.Throwable)
> >>>>>> +     */
> >>>>>> +    @Override
> >>>>>> +    public void info(final String msg, final Throwable thrown) {
> >>>>>> +        logger.info(msg, thrown);
> >>>>>> +    }
> >>>>>> +
> >>>>>> +    /*
> >>>>>> +     * (non-Javadoc)
> >>>>>> +     *
> >>>>>> +     * @see org.eclipse.jetty.util.log.Logger#info(java.lang.
> >>>> Throwable)
> >>>>>> +     */
> >>>>>> +    @Override
> >>>>>> +    public void info(final Throwable thrown) {
> >>>>>> +        logger.info(thrown);
> >>>>>> +    }
> >>>>>> +
> >>>>>> +    /*
> >>>>>> +     * (non-Javadoc)
> >>>>>> +     *
> >>>>>> +     * @see org.eclipse.jetty.util.log.Logger#isDebugEnabled()
> >>>>>> +     */
> >>>>>> +    @Override
> >>>>>> +    public boolean isDebugEnabled() {
> >>>>>> +        return logger.isDebugEnabled();
> >>>>>> +    }
> >>>>>> +
> >>>>>> +    /*
> >>>>>> +     * (non-Javadoc)
> >>>>>> +     *
> >>>>>> +     * @see org.eclipse.jetty.util.log.
> >>> AbstractLogger#newLogger(java.
> >>>>>> lang.String)
> >>>>>> +     */
> >>>>>> +    @Override
> >>>>>> +    protected Logger newLogger(final String fullname) {
> >>>>>> +        return new Log4j2Logger(fullname);
> >>>>>> +    }
> >>>>>> +
> >>>>>> +    /*
> >>>>>> +     * (non-Javadoc)
> >>>>>> +     *
> >>>>>> +     * @see org.eclipse.jetty.util.log.Logger#setDebugEnabled(
> >>>> boolean)
> >>>>>> +     */
> >>>>>> +    @Override
> >>>>>> +    public void setDebugEnabled(final boolean enabled) {
> >>>>>> +        warn("setDebugEnabled not implemented");
> >>>>>> +    }
> >>>>>> +
> >>>>>> +    /*
> >>>>>> +     * (non-Javadoc)
> >>>>>> +     *
> >>>>>> +     * @see org.eclipse.jetty.util.log.
> >>> Logger#warn(java.lang.String,
> >>>>>> java.lang.Object[])
> >>>>>> +     */
> >>>>>> +    @Override
> >>>>>> +    public void warn(final String msg, final Object... args) {
> >>>>>> +        logger.warn(msg, args);
> >>>>>> +    }
> >>>>>> +
> >>>>>> +    /*
> >>>>>> +     * (non-Javadoc)
> >>>>>> +     *
> >>>>>> +     * @see org.eclipse.jetty.util.log.
> >>> Logger#warn(java.lang.String,
> >>>>>> java.lang.Throwable)
> >>>>>> +     */
> >>>>>> +    @Override
> >>>>>> +    public void warn(final String msg, final Throwable thrown) {
> >>>>>> +        logger.warn(msg, thrown);
> >>>>>> +    }
> >>>>>> +
> >>>>>> +    /*
> >>>>>> +     * (non-Javadoc)
> >>>>>> +     *
> >>>>>> +     * @see org.eclipse.jetty.util.log.Logger#warn(java.lang.
> >>>> Throwable)
> >>>>>> +     */
> >>>>>> +    @Override
> >>>>>> +    public void warn(final Throwable thrown) {
> >>>>>> +        logger.warn(thrown);
> >>>>>> +    }
> >>>>>> +
> >>>>>> +}
> >>>>>>
> >>>>>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> >>>>>> 7d52f131/src/changes/changes.xml
> >>>>>> ------------------------------------------------------------
> >>> ----------
> >>>>>> diff --git a/src/changes/changes.xml b/src/changes/changes.xml
> >>>>>> index 2bcefb2..070e4a1 100644
> >>>>>> --- a/src/changes/changes.xml
> >>>>>> +++ b/src/changes/changes.xml
> >>>>>> @@ -37,6 +37,9 @@
> >>>>>>      <action issue="LOG4J2-2103" dev="mikes" type="add">
> >>>>>>        XML encoding for PatternLayout.
> >>>>>>      </action>
> >>>>>> +      <action issue="LOG4J2-2114" dev="ggregory" type="add">
> >>>>>> +        Provide a native Log4j 2 implementation of Eclipse Jetty's
> >>>>>> org.eclipse.jetty.util.log.Logger.
> >>>>>> +      </action>
> >>>>>>      <action issue="LOG4J2-1203" dev="mikes" type="add"
> >>>> due-to="Robert
> >>>>>> Turner">
> >>>>>>        Allow filtering of line breaks in layout pattern.
> >>>>>>      </action>
> >>>>>>
> >>>>>>
> >>>>>
> >>>>>
> >>>>> --
> >>>>> Matt Sicker <bo...@gmail.com>
> >>>>>
> >>>>
> >>>
> >>>
> >>>
> >>> --
> >>> Matt Sicker <bo...@gmail.com>
> >>>
> >
> >
> >
>
>
>

Re: logging-log4j2 git commit: [LOG4J2-2114] Provide a native Log4j 2 implementation of Eclipse Jetty's org.eclipse.jetty.util.log.Logger.

Posted by Ralph Goers <ra...@dslextreme.com>.
Oh, but you probably don’t want to extend AbstractLogger. You really want the FQCN of the caller to be able to identify the ClassLoader and LoggerContext to use and you won’t get that from AbstractLogger’s getLogger method.

Ralph

> On Nov 11, 2017, at 2:45 PM, Ralph Goers <ra...@dslextreme.com> wrote:
> 
> Sure. Look at TomcatLogger. It does exactly what you are trying to do.
> 
> Ralph
> 
>> On Nov 11, 2017, at 2:02 PM, Gary Gregory <ga...@gmail.com> wrote:
>> 
>> The Javadoc for Log4j's LoggerAdapter says "This registry should not be
>> used for Log4j Loggers; it is instead used for creating bridges to other
>> external log systems.".
>> 
>> In this case we are not bridging TO another log system. We are plugging
>> INTO Jetty's log system and subclassing Jetty's own LoggerAdapter class
>> (out convenience.)
>> 
>> Further thoughts?
>> 
>> Gary
>> 
>> On Fri, Nov 10, 2017 at 9:25 PM, Matt Sicker <bo...@gmail.com> wrote:
>> 
>>> IIRC, the easiest way to support it might be to use
>>> https://logging.apache.org/log4j/2.x/log4j-api/apidocs/
>>> org/apache/logging/log4j/spi/AbstractLoggerAdapter.html
>>> 
>>> On 10 November 2017 at 22:16, Gary Gregory <ga...@gmail.com> wrote:
>>> 
>>>> I think you are correct...
>>>> 
>>>> Gary
>>>> 
>>>> On Fri, Nov 10, 2017 at 6:59 PM, Matt Sicker <bo...@gmail.com> wrote:
>>>> 
>>>>> Wouldn't this implementation contain incorrect caller location
>>>> information?
>>>>> 
>>>>> On 10 November 2017 at 19:25, <gg...@apache.org> wrote:
>>>>> 
>>>>>> Repository: logging-log4j2
>>>>>> Updated Branches:
>>>>>> refs/heads/master aad2f132b -> 7d52f131e
>>>>>> 
>>>>>> 
>>>>>> [LOG4J2-2114] Provide a native Log4j 2 implementation of Eclipse
>>>> Jetty's
>>>>>> org.eclipse.jetty.util.log.Logger.
>>>>>> 
>>>>>> Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
>>>>>> Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/
>>>>>> commit/7d52f131
>>>>>> Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/
>>>>> 7d52f131
>>>>>> Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/
>>>>> 7d52f131
>>>>>> 
>>>>>> Branch: refs/heads/master
>>>>>> Commit: 7d52f131ec1e000834bcb40343f3f2d41805c75a
>>>>>> Parents: aad2f13
>>>>>> Author: Gary Gregory <gg...@apache.org>
>>>>>> Authored: Fri Nov 10 18:25:47 2017 -0700
>>>>>> Committer: Gary Gregory <gg...@apache.org>
>>>>>> Committed: Fri Nov 10 18:25:47 2017 -0700
>>>>>> 
>>>>>> ------------------------------------------------------------
>>> ----------
>>>>>> log4j-appserver/pom.xml                         |   8 +
>>>>>> .../log4j/appserver/jetty/Log4j2Logger.java     | 184
>>>>> +++++++++++++++++++
>>>>>> src/changes/changes.xml                         |   3 +
>>>>>> 3 files changed, 195 insertions(+)
>>>>>> ------------------------------------------------------------
>>> ----------
>>>>>> 
>>>>>> 
>>>>>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
>>>>>> 7d52f131/log4j-appserver/pom.xml
>>>>>> ------------------------------------------------------------
>>> ----------
>>>>>> diff --git a/log4j-appserver/pom.xml b/log4j-appserver/pom.xml
>>>>>> index e96b1fc..6acd77b 100644
>>>>>> --- a/log4j-appserver/pom.xml
>>>>>> +++ b/log4j-appserver/pom.xml
>>>>>> @@ -34,6 +34,7 @@
>>>>>>    <docLabel>Web Documentation</docLabel>
>>>>>>    <projectDir>/log4j-appserver</projectDir>
>>>>>>    <tomcat.version>8.5.20</tomcat.version>
>>>>>> +    <jetty.version>8.2.0.v20160908</jetty.version> <!--  Jetty 9
>>>>>> requires Java 8 -->
>>>>>>    <module.name>org.apache.logging.log4j.appserver</module.name>
>>>>>>  </properties>
>>>>>> 
>>>>>> @@ -56,6 +57,7 @@
>>>>>>      <groupId>org.apache.tomcat</groupId>
>>>>>>      <artifactId>tomcat-catalina</artifactId>
>>>>>>      <version>${tomcat.version}</version>
>>>>>> +      <scope>provided</scope>
>>>>>>      <exclusions>
>>>>>>        <exclusion>
>>>>>>          <groupId>org.apache.tomcat</groupId>
>>>>>> @@ -71,6 +73,12 @@
>>>>>>        </exclusion>
>>>>>>      </exclusions>
>>>>>>    </dependency>
>>>>>> +    <dependency>
>>>>>> +      <groupId>org.eclipse.jetty</groupId>
>>>>>> +      <artifactId>jetty-util</artifactId>
>>>>>> +      <version>${jetty.version}</version>
>>>>>> +      <scope>provided</scope>
>>>>>> +    </dependency>
>>>>>> 
>>>>>>    <!-- Test dependencies -->
>>>>>>    <dependency>
>>>>>> 
>>>>>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
>>>>>> 7d52f131/log4j-appserver/src/main/java/org/apache/logging/
>>>>>> log4j/appserver/jetty/Log4j2Logger.java
>>>>>> ------------------------------------------------------------
>>> ----------
>>>>>> diff --git a/log4j-appserver/src/main/java/org/apache/logging/log4j/
>>>>>> appserver/jetty/Log4j2Logger.java b/log4j-appserver/src/main/
>>>>>> java/org/apache/logging/log4j/appserver/jetty/Log4j2Logger.java
>>>>>> new file mode 100644
>>>>>> index 0000000..7d1ce14
>>>>>> --- /dev/null
>>>>>> +++ b/log4j-appserver/src/main/java/org/apache/logging/log4j/
>>>>>> appserver/jetty/Log4j2Logger.java
>>>>>> @@ -0,0 +1,184 @@
>>>>>> +/*
>>>>>> + * Licensed to the Apache Software Foundation (ASF) under one or
>>> more
>>>>>> + * contributor license agreements. See the NOTICE file distributed
>>>> with
>>>>>> + * this work for additional information regarding copyright
>>> ownership.
>>>>>> + * The ASF licenses this file to You under the Apache license,
>>> Version
>>>>> 2.0
>>>>>> + * (the "License"); you may not use this file except in compliance
>>>> with
>>>>>> + * the License. You may obtain a copy of the License at
>>>>>> + *
>>>>>> + *      http://www.apache.org/licenses/LICENSE-2.0
>>>>>> + *
>>>>>> + * Unless required by applicable law or agreed to in writing,
>>> software
>>>>>> + * distributed under the License is distributed on an "AS IS" BASIS,
>>>>>> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>>>>>> implied.
>>>>>> + * See the license for the specific language governing permissions
>>> and
>>>>>> + * limitations under the license.
>>>>>> + */
>>>>>> +
>>>>>> +package org.apache.logging.log4j.appserver.jetty;
>>>>>> +
>>>>>> +import org.apache.logging.log4j.LogManager;
>>>>>> +import org.eclipse.jetty.util.log.AbstractLogger;
>>>>>> +import org.eclipse.jetty.util.log.Logger;
>>>>>> +
>>>>>> +/**
>>>>>> + * Provides a native Apache Log4j 2 for Jetty logging.
>>>>>> + */
>>>>>> +public class Log4j2Logger extends AbstractLogger {
>>>>>> +
>>>>>> +    private final org.apache.logging.log4j.Logger logger;
>>>>>> +
>>>>>> +    private final String name;
>>>>>> +
>>>>>> +    public Log4j2Logger(final String name) {
>>>>>> +        super();
>>>>>> +        this.name = name;
>>>>>> +        this.logger = LogManager.getLogger(name);
>>>>>> +    }
>>>>>> +
>>>>>> +    public Log4j2Logger() {
>>>>>> +        this("");
>>>>>> +    }
>>>>>> +
>>>>>> +    /*
>>>>>> +     * (non-Javadoc)
>>>>>> +     *
>>>>>> +     * @see org.eclipse.jetty.util.log.
>>> Logger#debug(java.lang.String,
>>>>>> java.lang.Object[])
>>>>>> +     */
>>>>>> +    @Override
>>>>>> +    public void debug(final String msg, final Object... args) {
>>>>>> +        logger.debug(msg, args);
>>>>>> +    }
>>>>>> +
>>>>>> +    /*
>>>>>> +     * (non-Javadoc)
>>>>>> +     *
>>>>>> +     * @see org.eclipse.jetty.util.log.
>>> Logger#debug(java.lang.String,
>>>>>> java.lang.Throwable)
>>>>>> +     */
>>>>>> +    @Override
>>>>>> +    public void debug(final String msg, final Throwable thrown) {
>>>>>> +        logger.debug(msg, thrown);
>>>>>> +    }
>>>>>> +
>>>>>> +    /*
>>>>>> +     * (non-Javadoc)
>>>>>> +     *
>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#debug(java.lang.
>>>>> Throwable)
>>>>>> +     */
>>>>>> +    @Override
>>>>>> +    public void debug(final Throwable thrown) {
>>>>>> +        logger.debug(thrown);
>>>>>> +    }
>>>>>> +
>>>>>> +    /*
>>>>>> +     * (non-Javadoc)
>>>>>> +     *
>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#getName()
>>>>>> +     */
>>>>>> +    @Override
>>>>>> +    public String getName() {
>>>>>> +        return name;
>>>>>> +    }
>>>>>> +
>>>>>> +    /*
>>>>>> +     * (non-Javadoc)
>>>>>> +     *
>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#ignore(java.lang.
>>>>> Throwable)
>>>>>> +     */
>>>>>> +    @Override
>>>>>> +    public void ignore(final Throwable ignored) {
>>>>>> +        // TODO Auto-generated method stub
>>>>>> +
>>>>>> +    }
>>>>>> +
>>>>>> +    /*
>>>>>> +     * (non-Javadoc)
>>>>>> +     *
>>>>>> +     * @see org.eclipse.jetty.util.log.
>>> Logger#info(java.lang.String,
>>>>>> java.lang.Object[])
>>>>>> +     */
>>>>>> +    @Override
>>>>>> +    public void info(final String msg, final Object... args) {
>>>>>> +        logger.info(msg, args);
>>>>>> +    }
>>>>>> +
>>>>>> +    /*
>>>>>> +     * (non-Javadoc)
>>>>>> +     *
>>>>>> +     * @see org.eclipse.jetty.util.log.
>>> Logger#info(java.lang.String,
>>>>>> java.lang.Throwable)
>>>>>> +     */
>>>>>> +    @Override
>>>>>> +    public void info(final String msg, final Throwable thrown) {
>>>>>> +        logger.info(msg, thrown);
>>>>>> +    }
>>>>>> +
>>>>>> +    /*
>>>>>> +     * (non-Javadoc)
>>>>>> +     *
>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#info(java.lang.
>>>> Throwable)
>>>>>> +     */
>>>>>> +    @Override
>>>>>> +    public void info(final Throwable thrown) {
>>>>>> +        logger.info(thrown);
>>>>>> +    }
>>>>>> +
>>>>>> +    /*
>>>>>> +     * (non-Javadoc)
>>>>>> +     *
>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#isDebugEnabled()
>>>>>> +     */
>>>>>> +    @Override
>>>>>> +    public boolean isDebugEnabled() {
>>>>>> +        return logger.isDebugEnabled();
>>>>>> +    }
>>>>>> +
>>>>>> +    /*
>>>>>> +     * (non-Javadoc)
>>>>>> +     *
>>>>>> +     * @see org.eclipse.jetty.util.log.
>>> AbstractLogger#newLogger(java.
>>>>>> lang.String)
>>>>>> +     */
>>>>>> +    @Override
>>>>>> +    protected Logger newLogger(final String fullname) {
>>>>>> +        return new Log4j2Logger(fullname);
>>>>>> +    }
>>>>>> +
>>>>>> +    /*
>>>>>> +     * (non-Javadoc)
>>>>>> +     *
>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#setDebugEnabled(
>>>> boolean)
>>>>>> +     */
>>>>>> +    @Override
>>>>>> +    public void setDebugEnabled(final boolean enabled) {
>>>>>> +        warn("setDebugEnabled not implemented");
>>>>>> +    }
>>>>>> +
>>>>>> +    /*
>>>>>> +     * (non-Javadoc)
>>>>>> +     *
>>>>>> +     * @see org.eclipse.jetty.util.log.
>>> Logger#warn(java.lang.String,
>>>>>> java.lang.Object[])
>>>>>> +     */
>>>>>> +    @Override
>>>>>> +    public void warn(final String msg, final Object... args) {
>>>>>> +        logger.warn(msg, args);
>>>>>> +    }
>>>>>> +
>>>>>> +    /*
>>>>>> +     * (non-Javadoc)
>>>>>> +     *
>>>>>> +     * @see org.eclipse.jetty.util.log.
>>> Logger#warn(java.lang.String,
>>>>>> java.lang.Throwable)
>>>>>> +     */
>>>>>> +    @Override
>>>>>> +    public void warn(final String msg, final Throwable thrown) {
>>>>>> +        logger.warn(msg, thrown);
>>>>>> +    }
>>>>>> +
>>>>>> +    /*
>>>>>> +     * (non-Javadoc)
>>>>>> +     *
>>>>>> +     * @see org.eclipse.jetty.util.log.Logger#warn(java.lang.
>>>> Throwable)
>>>>>> +     */
>>>>>> +    @Override
>>>>>> +    public void warn(final Throwable thrown) {
>>>>>> +        logger.warn(thrown);
>>>>>> +    }
>>>>>> +
>>>>>> +}
>>>>>> 
>>>>>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
>>>>>> 7d52f131/src/changes/changes.xml
>>>>>> ------------------------------------------------------------
>>> ----------
>>>>>> diff --git a/src/changes/changes.xml b/src/changes/changes.xml
>>>>>> index 2bcefb2..070e4a1 100644
>>>>>> --- a/src/changes/changes.xml
>>>>>> +++ b/src/changes/changes.xml
>>>>>> @@ -37,6 +37,9 @@
>>>>>>      <action issue="LOG4J2-2103" dev="mikes" type="add">
>>>>>>        XML encoding for PatternLayout.
>>>>>>      </action>
>>>>>> +      <action issue="LOG4J2-2114" dev="ggregory" type="add">
>>>>>> +        Provide a native Log4j 2 implementation of Eclipse Jetty's
>>>>>> org.eclipse.jetty.util.log.Logger.
>>>>>> +      </action>
>>>>>>      <action issue="LOG4J2-1203" dev="mikes" type="add"
>>>> due-to="Robert
>>>>>> Turner">
>>>>>>        Allow filtering of line breaks in layout pattern.
>>>>>>      </action>
>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>>>> --
>>>>> Matt Sicker <bo...@gmail.com>
>>>>> 
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> Matt Sicker <bo...@gmail.com>
>>> 
> 
> 
> 



Re: logging-log4j2 git commit: [LOG4J2-2114] Provide a native Log4j 2 implementation of Eclipse Jetty's org.eclipse.jetty.util.log.Logger.

Posted by Ralph Goers <ra...@dslextreme.com>.
Sure. Look at TomcatLogger. It does exactly what you are trying to do.

Ralph

> On Nov 11, 2017, at 2:02 PM, Gary Gregory <ga...@gmail.com> wrote:
> 
> The Javadoc for Log4j's LoggerAdapter says "This registry should not be
> used for Log4j Loggers; it is instead used for creating bridges to other
> external log systems.".
> 
> In this case we are not bridging TO another log system. We are plugging
> INTO Jetty's log system and subclassing Jetty's own LoggerAdapter class
> (out convenience.)
> 
> Further thoughts?
> 
> Gary
> 
> On Fri, Nov 10, 2017 at 9:25 PM, Matt Sicker <bo...@gmail.com> wrote:
> 
>> IIRC, the easiest way to support it might be to use
>> https://logging.apache.org/log4j/2.x/log4j-api/apidocs/
>> org/apache/logging/log4j/spi/AbstractLoggerAdapter.html
>> 
>> On 10 November 2017 at 22:16, Gary Gregory <ga...@gmail.com> wrote:
>> 
>>> I think you are correct...
>>> 
>>> Gary
>>> 
>>> On Fri, Nov 10, 2017 at 6:59 PM, Matt Sicker <bo...@gmail.com> wrote:
>>> 
>>>> Wouldn't this implementation contain incorrect caller location
>>> information?
>>>> 
>>>> On 10 November 2017 at 19:25, <gg...@apache.org> wrote:
>>>> 
>>>>> Repository: logging-log4j2
>>>>> Updated Branches:
>>>>>  refs/heads/master aad2f132b -> 7d52f131e
>>>>> 
>>>>> 
>>>>> [LOG4J2-2114] Provide a native Log4j 2 implementation of Eclipse
>>> Jetty's
>>>>> org.eclipse.jetty.util.log.Logger.
>>>>> 
>>>>> Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
>>>>> Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/
>>>>> commit/7d52f131
>>>>> Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/
>>>> 7d52f131
>>>>> Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/
>>>> 7d52f131
>>>>> 
>>>>> Branch: refs/heads/master
>>>>> Commit: 7d52f131ec1e000834bcb40343f3f2d41805c75a
>>>>> Parents: aad2f13
>>>>> Author: Gary Gregory <gg...@apache.org>
>>>>> Authored: Fri Nov 10 18:25:47 2017 -0700
>>>>> Committer: Gary Gregory <gg...@apache.org>
>>>>> Committed: Fri Nov 10 18:25:47 2017 -0700
>>>>> 
>>>>> ------------------------------------------------------------
>> ----------
>>>>> log4j-appserver/pom.xml                         |   8 +
>>>>> .../log4j/appserver/jetty/Log4j2Logger.java     | 184
>>>> +++++++++++++++++++
>>>>> src/changes/changes.xml                         |   3 +
>>>>> 3 files changed, 195 insertions(+)
>>>>> ------------------------------------------------------------
>> ----------
>>>>> 
>>>>> 
>>>>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
>>>>> 7d52f131/log4j-appserver/pom.xml
>>>>> ------------------------------------------------------------
>> ----------
>>>>> diff --git a/log4j-appserver/pom.xml b/log4j-appserver/pom.xml
>>>>> index e96b1fc..6acd77b 100644
>>>>> --- a/log4j-appserver/pom.xml
>>>>> +++ b/log4j-appserver/pom.xml
>>>>> @@ -34,6 +34,7 @@
>>>>>     <docLabel>Web Documentation</docLabel>
>>>>>     <projectDir>/log4j-appserver</projectDir>
>>>>>     <tomcat.version>8.5.20</tomcat.version>
>>>>> +    <jetty.version>8.2.0.v20160908</jetty.version> <!--  Jetty 9
>>>>> requires Java 8 -->
>>>>>     <module.name>org.apache.logging.log4j.appserver</module.name>
>>>>>   </properties>
>>>>> 
>>>>> @@ -56,6 +57,7 @@
>>>>>       <groupId>org.apache.tomcat</groupId>
>>>>>       <artifactId>tomcat-catalina</artifactId>
>>>>>       <version>${tomcat.version}</version>
>>>>> +      <scope>provided</scope>
>>>>>       <exclusions>
>>>>>         <exclusion>
>>>>>           <groupId>org.apache.tomcat</groupId>
>>>>> @@ -71,6 +73,12 @@
>>>>>         </exclusion>
>>>>>       </exclusions>
>>>>>     </dependency>
>>>>> +    <dependency>
>>>>> +      <groupId>org.eclipse.jetty</groupId>
>>>>> +      <artifactId>jetty-util</artifactId>
>>>>> +      <version>${jetty.version}</version>
>>>>> +      <scope>provided</scope>
>>>>> +    </dependency>
>>>>> 
>>>>>     <!-- Test dependencies -->
>>>>>     <dependency>
>>>>> 
>>>>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
>>>>> 7d52f131/log4j-appserver/src/main/java/org/apache/logging/
>>>>> log4j/appserver/jetty/Log4j2Logger.java
>>>>> ------------------------------------------------------------
>> ----------
>>>>> diff --git a/log4j-appserver/src/main/java/org/apache/logging/log4j/
>>>>> appserver/jetty/Log4j2Logger.java b/log4j-appserver/src/main/
>>>>> java/org/apache/logging/log4j/appserver/jetty/Log4j2Logger.java
>>>>> new file mode 100644
>>>>> index 0000000..7d1ce14
>>>>> --- /dev/null
>>>>> +++ b/log4j-appserver/src/main/java/org/apache/logging/log4j/
>>>>> appserver/jetty/Log4j2Logger.java
>>>>> @@ -0,0 +1,184 @@
>>>>> +/*
>>>>> + * Licensed to the Apache Software Foundation (ASF) under one or
>> more
>>>>> + * contributor license agreements. See the NOTICE file distributed
>>> with
>>>>> + * this work for additional information regarding copyright
>> ownership.
>>>>> + * The ASF licenses this file to You under the Apache license,
>> Version
>>>> 2.0
>>>>> + * (the "License"); you may not use this file except in compliance
>>> with
>>>>> + * the License. You may obtain a copy of the License at
>>>>> + *
>>>>> + *      http://www.apache.org/licenses/LICENSE-2.0
>>>>> + *
>>>>> + * Unless required by applicable law or agreed to in writing,
>> software
>>>>> + * distributed under the License is distributed on an "AS IS" BASIS,
>>>>> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>>>>> implied.
>>>>> + * See the license for the specific language governing permissions
>> and
>>>>> + * limitations under the license.
>>>>> + */
>>>>> +
>>>>> +package org.apache.logging.log4j.appserver.jetty;
>>>>> +
>>>>> +import org.apache.logging.log4j.LogManager;
>>>>> +import org.eclipse.jetty.util.log.AbstractLogger;
>>>>> +import org.eclipse.jetty.util.log.Logger;
>>>>> +
>>>>> +/**
>>>>> + * Provides a native Apache Log4j 2 for Jetty logging.
>>>>> + */
>>>>> +public class Log4j2Logger extends AbstractLogger {
>>>>> +
>>>>> +    private final org.apache.logging.log4j.Logger logger;
>>>>> +
>>>>> +    private final String name;
>>>>> +
>>>>> +    public Log4j2Logger(final String name) {
>>>>> +        super();
>>>>> +        this.name = name;
>>>>> +        this.logger = LogManager.getLogger(name);
>>>>> +    }
>>>>> +
>>>>> +    public Log4j2Logger() {
>>>>> +        this("");
>>>>> +    }
>>>>> +
>>>>> +    /*
>>>>> +     * (non-Javadoc)
>>>>> +     *
>>>>> +     * @see org.eclipse.jetty.util.log.
>> Logger#debug(java.lang.String,
>>>>> java.lang.Object[])
>>>>> +     */
>>>>> +    @Override
>>>>> +    public void debug(final String msg, final Object... args) {
>>>>> +        logger.debug(msg, args);
>>>>> +    }
>>>>> +
>>>>> +    /*
>>>>> +     * (non-Javadoc)
>>>>> +     *
>>>>> +     * @see org.eclipse.jetty.util.log.
>> Logger#debug(java.lang.String,
>>>>> java.lang.Throwable)
>>>>> +     */
>>>>> +    @Override
>>>>> +    public void debug(final String msg, final Throwable thrown) {
>>>>> +        logger.debug(msg, thrown);
>>>>> +    }
>>>>> +
>>>>> +    /*
>>>>> +     * (non-Javadoc)
>>>>> +     *
>>>>> +     * @see org.eclipse.jetty.util.log.Logger#debug(java.lang.
>>>> Throwable)
>>>>> +     */
>>>>> +    @Override
>>>>> +    public void debug(final Throwable thrown) {
>>>>> +        logger.debug(thrown);
>>>>> +    }
>>>>> +
>>>>> +    /*
>>>>> +     * (non-Javadoc)
>>>>> +     *
>>>>> +     * @see org.eclipse.jetty.util.log.Logger#getName()
>>>>> +     */
>>>>> +    @Override
>>>>> +    public String getName() {
>>>>> +        return name;
>>>>> +    }
>>>>> +
>>>>> +    /*
>>>>> +     * (non-Javadoc)
>>>>> +     *
>>>>> +     * @see org.eclipse.jetty.util.log.Logger#ignore(java.lang.
>>>> Throwable)
>>>>> +     */
>>>>> +    @Override
>>>>> +    public void ignore(final Throwable ignored) {
>>>>> +        // TODO Auto-generated method stub
>>>>> +
>>>>> +    }
>>>>> +
>>>>> +    /*
>>>>> +     * (non-Javadoc)
>>>>> +     *
>>>>> +     * @see org.eclipse.jetty.util.log.
>> Logger#info(java.lang.String,
>>>>> java.lang.Object[])
>>>>> +     */
>>>>> +    @Override
>>>>> +    public void info(final String msg, final Object... args) {
>>>>> +        logger.info(msg, args);
>>>>> +    }
>>>>> +
>>>>> +    /*
>>>>> +     * (non-Javadoc)
>>>>> +     *
>>>>> +     * @see org.eclipse.jetty.util.log.
>> Logger#info(java.lang.String,
>>>>> java.lang.Throwable)
>>>>> +     */
>>>>> +    @Override
>>>>> +    public void info(final String msg, final Throwable thrown) {
>>>>> +        logger.info(msg, thrown);
>>>>> +    }
>>>>> +
>>>>> +    /*
>>>>> +     * (non-Javadoc)
>>>>> +     *
>>>>> +     * @see org.eclipse.jetty.util.log.Logger#info(java.lang.
>>> Throwable)
>>>>> +     */
>>>>> +    @Override
>>>>> +    public void info(final Throwable thrown) {
>>>>> +        logger.info(thrown);
>>>>> +    }
>>>>> +
>>>>> +    /*
>>>>> +     * (non-Javadoc)
>>>>> +     *
>>>>> +     * @see org.eclipse.jetty.util.log.Logger#isDebugEnabled()
>>>>> +     */
>>>>> +    @Override
>>>>> +    public boolean isDebugEnabled() {
>>>>> +        return logger.isDebugEnabled();
>>>>> +    }
>>>>> +
>>>>> +    /*
>>>>> +     * (non-Javadoc)
>>>>> +     *
>>>>> +     * @see org.eclipse.jetty.util.log.
>> AbstractLogger#newLogger(java.
>>>>> lang.String)
>>>>> +     */
>>>>> +    @Override
>>>>> +    protected Logger newLogger(final String fullname) {
>>>>> +        return new Log4j2Logger(fullname);
>>>>> +    }
>>>>> +
>>>>> +    /*
>>>>> +     * (non-Javadoc)
>>>>> +     *
>>>>> +     * @see org.eclipse.jetty.util.log.Logger#setDebugEnabled(
>>> boolean)
>>>>> +     */
>>>>> +    @Override
>>>>> +    public void setDebugEnabled(final boolean enabled) {
>>>>> +        warn("setDebugEnabled not implemented");
>>>>> +    }
>>>>> +
>>>>> +    /*
>>>>> +     * (non-Javadoc)
>>>>> +     *
>>>>> +     * @see org.eclipse.jetty.util.log.
>> Logger#warn(java.lang.String,
>>>>> java.lang.Object[])
>>>>> +     */
>>>>> +    @Override
>>>>> +    public void warn(final String msg, final Object... args) {
>>>>> +        logger.warn(msg, args);
>>>>> +    }
>>>>> +
>>>>> +    /*
>>>>> +     * (non-Javadoc)
>>>>> +     *
>>>>> +     * @see org.eclipse.jetty.util.log.
>> Logger#warn(java.lang.String,
>>>>> java.lang.Throwable)
>>>>> +     */
>>>>> +    @Override
>>>>> +    public void warn(final String msg, final Throwable thrown) {
>>>>> +        logger.warn(msg, thrown);
>>>>> +    }
>>>>> +
>>>>> +    /*
>>>>> +     * (non-Javadoc)
>>>>> +     *
>>>>> +     * @see org.eclipse.jetty.util.log.Logger#warn(java.lang.
>>> Throwable)
>>>>> +     */
>>>>> +    @Override
>>>>> +    public void warn(final Throwable thrown) {
>>>>> +        logger.warn(thrown);
>>>>> +    }
>>>>> +
>>>>> +}
>>>>> 
>>>>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
>>>>> 7d52f131/src/changes/changes.xml
>>>>> ------------------------------------------------------------
>> ----------
>>>>> diff --git a/src/changes/changes.xml b/src/changes/changes.xml
>>>>> index 2bcefb2..070e4a1 100644
>>>>> --- a/src/changes/changes.xml
>>>>> +++ b/src/changes/changes.xml
>>>>> @@ -37,6 +37,9 @@
>>>>>       <action issue="LOG4J2-2103" dev="mikes" type="add">
>>>>>         XML encoding for PatternLayout.
>>>>>       </action>
>>>>> +      <action issue="LOG4J2-2114" dev="ggregory" type="add">
>>>>> +        Provide a native Log4j 2 implementation of Eclipse Jetty's
>>>>> org.eclipse.jetty.util.log.Logger.
>>>>> +      </action>
>>>>>       <action issue="LOG4J2-1203" dev="mikes" type="add"
>>> due-to="Robert
>>>>> Turner">
>>>>>         Allow filtering of line breaks in layout pattern.
>>>>>       </action>
>>>>> 
>>>>> 
>>>> 
>>>> 
>>>> --
>>>> Matt Sicker <bo...@gmail.com>
>>>> 
>>> 
>> 
>> 
>> 
>> --
>> Matt Sicker <bo...@gmail.com>
>> 



Re: logging-log4j2 git commit: [LOG4J2-2114] Provide a native Log4j 2 implementation of Eclipse Jetty's org.eclipse.jetty.util.log.Logger.

Posted by Gary Gregory <ga...@gmail.com>.
The Javadoc for Log4j's LoggerAdapter says "This registry should not be
used for Log4j Loggers; it is instead used for creating bridges to other
external log systems.".

In this case we are not bridging TO another log system. We are plugging
INTO Jetty's log system and subclassing Jetty's own LoggerAdapter class
(out convenience.)

Further thoughts?

Gary

On Fri, Nov 10, 2017 at 9:25 PM, Matt Sicker <bo...@gmail.com> wrote:

> IIRC, the easiest way to support it might be to use
> https://logging.apache.org/log4j/2.x/log4j-api/apidocs/
> org/apache/logging/log4j/spi/AbstractLoggerAdapter.html
>
> On 10 November 2017 at 22:16, Gary Gregory <ga...@gmail.com> wrote:
>
> > I think you are correct...
> >
> > Gary
> >
> > On Fri, Nov 10, 2017 at 6:59 PM, Matt Sicker <bo...@gmail.com> wrote:
> >
> > > Wouldn't this implementation contain incorrect caller location
> > information?
> > >
> > > On 10 November 2017 at 19:25, <gg...@apache.org> wrote:
> > >
> > > > Repository: logging-log4j2
> > > > Updated Branches:
> > > >   refs/heads/master aad2f132b -> 7d52f131e
> > > >
> > > >
> > > > [LOG4J2-2114] Provide a native Log4j 2 implementation of Eclipse
> > Jetty's
> > > > org.eclipse.jetty.util.log.Logger.
> > > >
> > > > Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
> > > > Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/
> > > > commit/7d52f131
> > > > Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/
> > > 7d52f131
> > > > Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/
> > > 7d52f131
> > > >
> > > > Branch: refs/heads/master
> > > > Commit: 7d52f131ec1e000834bcb40343f3f2d41805c75a
> > > > Parents: aad2f13
> > > > Author: Gary Gregory <gg...@apache.org>
> > > > Authored: Fri Nov 10 18:25:47 2017 -0700
> > > > Committer: Gary Gregory <gg...@apache.org>
> > > > Committed: Fri Nov 10 18:25:47 2017 -0700
> > > >
> > > > ------------------------------------------------------------
> ----------
> > > >  log4j-appserver/pom.xml                         |   8 +
> > > >  .../log4j/appserver/jetty/Log4j2Logger.java     | 184
> > > +++++++++++++++++++
> > > >  src/changes/changes.xml                         |   3 +
> > > >  3 files changed, 195 insertions(+)
> > > > ------------------------------------------------------------
> ----------
> > > >
> > > >
> > > > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> > > > 7d52f131/log4j-appserver/pom.xml
> > > > ------------------------------------------------------------
> ----------
> > > > diff --git a/log4j-appserver/pom.xml b/log4j-appserver/pom.xml
> > > > index e96b1fc..6acd77b 100644
> > > > --- a/log4j-appserver/pom.xml
> > > > +++ b/log4j-appserver/pom.xml
> > > > @@ -34,6 +34,7 @@
> > > >      <docLabel>Web Documentation</docLabel>
> > > >      <projectDir>/log4j-appserver</projectDir>
> > > >      <tomcat.version>8.5.20</tomcat.version>
> > > > +    <jetty.version>8.2.0.v20160908</jetty.version> <!--  Jetty 9
> > > > requires Java 8 -->
> > > >      <module.name>org.apache.logging.log4j.appserver</module.name>
> > > >    </properties>
> > > >
> > > > @@ -56,6 +57,7 @@
> > > >        <groupId>org.apache.tomcat</groupId>
> > > >        <artifactId>tomcat-catalina</artifactId>
> > > >        <version>${tomcat.version}</version>
> > > > +      <scope>provided</scope>
> > > >        <exclusions>
> > > >          <exclusion>
> > > >            <groupId>org.apache.tomcat</groupId>
> > > > @@ -71,6 +73,12 @@
> > > >          </exclusion>
> > > >        </exclusions>
> > > >      </dependency>
> > > > +    <dependency>
> > > > +      <groupId>org.eclipse.jetty</groupId>
> > > > +      <artifactId>jetty-util</artifactId>
> > > > +      <version>${jetty.version}</version>
> > > > +      <scope>provided</scope>
> > > > +    </dependency>
> > > >
> > > >      <!-- Test dependencies -->
> > > >      <dependency>
> > > >
> > > > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> > > > 7d52f131/log4j-appserver/src/main/java/org/apache/logging/
> > > > log4j/appserver/jetty/Log4j2Logger.java
> > > > ------------------------------------------------------------
> ----------
> > > > diff --git a/log4j-appserver/src/main/java/org/apache/logging/log4j/
> > > > appserver/jetty/Log4j2Logger.java b/log4j-appserver/src/main/
> > > > java/org/apache/logging/log4j/appserver/jetty/Log4j2Logger.java
> > > > new file mode 100644
> > > > index 0000000..7d1ce14
> > > > --- /dev/null
> > > > +++ b/log4j-appserver/src/main/java/org/apache/logging/log4j/
> > > > appserver/jetty/Log4j2Logger.java
> > > > @@ -0,0 +1,184 @@
> > > > +/*
> > > > + * Licensed to the Apache Software Foundation (ASF) under one or
> more
> > > > + * contributor license agreements. See the NOTICE file distributed
> > with
> > > > + * this work for additional information regarding copyright
> ownership.
> > > > + * The ASF licenses this file to You under the Apache license,
> Version
> > > 2.0
> > > > + * (the "License"); you may not use this file except in compliance
> > with
> > > > + * the License. You may obtain a copy of the License at
> > > > + *
> > > > + *      http://www.apache.org/licenses/LICENSE-2.0
> > > > + *
> > > > + * Unless required by applicable law or agreed to in writing,
> software
> > > > + * distributed under the License is distributed on an "AS IS" BASIS,
> > > > + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> > > > implied.
> > > > + * See the license for the specific language governing permissions
> and
> > > > + * limitations under the license.
> > > > + */
> > > > +
> > > > +package org.apache.logging.log4j.appserver.jetty;
> > > > +
> > > > +import org.apache.logging.log4j.LogManager;
> > > > +import org.eclipse.jetty.util.log.AbstractLogger;
> > > > +import org.eclipse.jetty.util.log.Logger;
> > > > +
> > > > +/**
> > > > + * Provides a native Apache Log4j 2 for Jetty logging.
> > > > + */
> > > > +public class Log4j2Logger extends AbstractLogger {
> > > > +
> > > > +    private final org.apache.logging.log4j.Logger logger;
> > > > +
> > > > +    private final String name;
> > > > +
> > > > +    public Log4j2Logger(final String name) {
> > > > +        super();
> > > > +        this.name = name;
> > > > +        this.logger = LogManager.getLogger(name);
> > > > +    }
> > > > +
> > > > +    public Log4j2Logger() {
> > > > +        this("");
> > > > +    }
> > > > +
> > > > +    /*
> > > > +     * (non-Javadoc)
> > > > +     *
> > > > +     * @see org.eclipse.jetty.util.log.
> Logger#debug(java.lang.String,
> > > > java.lang.Object[])
> > > > +     */
> > > > +    @Override
> > > > +    public void debug(final String msg, final Object... args) {
> > > > +        logger.debug(msg, args);
> > > > +    }
> > > > +
> > > > +    /*
> > > > +     * (non-Javadoc)
> > > > +     *
> > > > +     * @see org.eclipse.jetty.util.log.
> Logger#debug(java.lang.String,
> > > > java.lang.Throwable)
> > > > +     */
> > > > +    @Override
> > > > +    public void debug(final String msg, final Throwable thrown) {
> > > > +        logger.debug(msg, thrown);
> > > > +    }
> > > > +
> > > > +    /*
> > > > +     * (non-Javadoc)
> > > > +     *
> > > > +     * @see org.eclipse.jetty.util.log.Logger#debug(java.lang.
> > > Throwable)
> > > > +     */
> > > > +    @Override
> > > > +    public void debug(final Throwable thrown) {
> > > > +        logger.debug(thrown);
> > > > +    }
> > > > +
> > > > +    /*
> > > > +     * (non-Javadoc)
> > > > +     *
> > > > +     * @see org.eclipse.jetty.util.log.Logger#getName()
> > > > +     */
> > > > +    @Override
> > > > +    public String getName() {
> > > > +        return name;
> > > > +    }
> > > > +
> > > > +    /*
> > > > +     * (non-Javadoc)
> > > > +     *
> > > > +     * @see org.eclipse.jetty.util.log.Logger#ignore(java.lang.
> > > Throwable)
> > > > +     */
> > > > +    @Override
> > > > +    public void ignore(final Throwable ignored) {
> > > > +        // TODO Auto-generated method stub
> > > > +
> > > > +    }
> > > > +
> > > > +    /*
> > > > +     * (non-Javadoc)
> > > > +     *
> > > > +     * @see org.eclipse.jetty.util.log.
> Logger#info(java.lang.String,
> > > > java.lang.Object[])
> > > > +     */
> > > > +    @Override
> > > > +    public void info(final String msg, final Object... args) {
> > > > +        logger.info(msg, args);
> > > > +    }
> > > > +
> > > > +    /*
> > > > +     * (non-Javadoc)
> > > > +     *
> > > > +     * @see org.eclipse.jetty.util.log.
> Logger#info(java.lang.String,
> > > > java.lang.Throwable)
> > > > +     */
> > > > +    @Override
> > > > +    public void info(final String msg, final Throwable thrown) {
> > > > +        logger.info(msg, thrown);
> > > > +    }
> > > > +
> > > > +    /*
> > > > +     * (non-Javadoc)
> > > > +     *
> > > > +     * @see org.eclipse.jetty.util.log.Logger#info(java.lang.
> > Throwable)
> > > > +     */
> > > > +    @Override
> > > > +    public void info(final Throwable thrown) {
> > > > +        logger.info(thrown);
> > > > +    }
> > > > +
> > > > +    /*
> > > > +     * (non-Javadoc)
> > > > +     *
> > > > +     * @see org.eclipse.jetty.util.log.Logger#isDebugEnabled()
> > > > +     */
> > > > +    @Override
> > > > +    public boolean isDebugEnabled() {
> > > > +        return logger.isDebugEnabled();
> > > > +    }
> > > > +
> > > > +    /*
> > > > +     * (non-Javadoc)
> > > > +     *
> > > > +     * @see org.eclipse.jetty.util.log.
> AbstractLogger#newLogger(java.
> > > > lang.String)
> > > > +     */
> > > > +    @Override
> > > > +    protected Logger newLogger(final String fullname) {
> > > > +        return new Log4j2Logger(fullname);
> > > > +    }
> > > > +
> > > > +    /*
> > > > +     * (non-Javadoc)
> > > > +     *
> > > > +     * @see org.eclipse.jetty.util.log.Logger#setDebugEnabled(
> > boolean)
> > > > +     */
> > > > +    @Override
> > > > +    public void setDebugEnabled(final boolean enabled) {
> > > > +        warn("setDebugEnabled not implemented");
> > > > +    }
> > > > +
> > > > +    /*
> > > > +     * (non-Javadoc)
> > > > +     *
> > > > +     * @see org.eclipse.jetty.util.log.
> Logger#warn(java.lang.String,
> > > > java.lang.Object[])
> > > > +     */
> > > > +    @Override
> > > > +    public void warn(final String msg, final Object... args) {
> > > > +        logger.warn(msg, args);
> > > > +    }
> > > > +
> > > > +    /*
> > > > +     * (non-Javadoc)
> > > > +     *
> > > > +     * @see org.eclipse.jetty.util.log.
> Logger#warn(java.lang.String,
> > > > java.lang.Throwable)
> > > > +     */
> > > > +    @Override
> > > > +    public void warn(final String msg, final Throwable thrown) {
> > > > +        logger.warn(msg, thrown);
> > > > +    }
> > > > +
> > > > +    /*
> > > > +     * (non-Javadoc)
> > > > +     *
> > > > +     * @see org.eclipse.jetty.util.log.Logger#warn(java.lang.
> > Throwable)
> > > > +     */
> > > > +    @Override
> > > > +    public void warn(final Throwable thrown) {
> > > > +        logger.warn(thrown);
> > > > +    }
> > > > +
> > > > +}
> > > >
> > > > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> > > > 7d52f131/src/changes/changes.xml
> > > > ------------------------------------------------------------
> ----------
> > > > diff --git a/src/changes/changes.xml b/src/changes/changes.xml
> > > > index 2bcefb2..070e4a1 100644
> > > > --- a/src/changes/changes.xml
> > > > +++ b/src/changes/changes.xml
> > > > @@ -37,6 +37,9 @@
> > > >        <action issue="LOG4J2-2103" dev="mikes" type="add">
> > > >          XML encoding for PatternLayout.
> > > >        </action>
> > > > +      <action issue="LOG4J2-2114" dev="ggregory" type="add">
> > > > +        Provide a native Log4j 2 implementation of Eclipse Jetty's
> > > > org.eclipse.jetty.util.log.Logger.
> > > > +      </action>
> > > >        <action issue="LOG4J2-1203" dev="mikes" type="add"
> > due-to="Robert
> > > > Turner">
> > > >          Allow filtering of line breaks in layout pattern.
> > > >        </action>
> > > >
> > > >
> > >
> > >
> > > --
> > > Matt Sicker <bo...@gmail.com>
> > >
> >
>
>
>
> --
> Matt Sicker <bo...@gmail.com>
>

Re: logging-log4j2 git commit: [LOG4J2-2114] Provide a native Log4j 2 implementation of Eclipse Jetty's org.eclipse.jetty.util.log.Logger.

Posted by Matt Sicker <bo...@gmail.com>.
IIRC, the easiest way to support it might be to use
https://logging.apache.org/log4j/2.x/log4j-api/apidocs/org/apache/logging/log4j/spi/AbstractLoggerAdapter.html

On 10 November 2017 at 22:16, Gary Gregory <ga...@gmail.com> wrote:

> I think you are correct...
>
> Gary
>
> On Fri, Nov 10, 2017 at 6:59 PM, Matt Sicker <bo...@gmail.com> wrote:
>
> > Wouldn't this implementation contain incorrect caller location
> information?
> >
> > On 10 November 2017 at 19:25, <gg...@apache.org> wrote:
> >
> > > Repository: logging-log4j2
> > > Updated Branches:
> > >   refs/heads/master aad2f132b -> 7d52f131e
> > >
> > >
> > > [LOG4J2-2114] Provide a native Log4j 2 implementation of Eclipse
> Jetty's
> > > org.eclipse.jetty.util.log.Logger.
> > >
> > > Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
> > > Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/
> > > commit/7d52f131
> > > Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/
> > 7d52f131
> > > Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/
> > 7d52f131
> > >
> > > Branch: refs/heads/master
> > > Commit: 7d52f131ec1e000834bcb40343f3f2d41805c75a
> > > Parents: aad2f13
> > > Author: Gary Gregory <gg...@apache.org>
> > > Authored: Fri Nov 10 18:25:47 2017 -0700
> > > Committer: Gary Gregory <gg...@apache.org>
> > > Committed: Fri Nov 10 18:25:47 2017 -0700
> > >
> > > ----------------------------------------------------------------------
> > >  log4j-appserver/pom.xml                         |   8 +
> > >  .../log4j/appserver/jetty/Log4j2Logger.java     | 184
> > +++++++++++++++++++
> > >  src/changes/changes.xml                         |   3 +
> > >  3 files changed, 195 insertions(+)
> > > ----------------------------------------------------------------------
> > >
> > >
> > > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> > > 7d52f131/log4j-appserver/pom.xml
> > > ----------------------------------------------------------------------
> > > diff --git a/log4j-appserver/pom.xml b/log4j-appserver/pom.xml
> > > index e96b1fc..6acd77b 100644
> > > --- a/log4j-appserver/pom.xml
> > > +++ b/log4j-appserver/pom.xml
> > > @@ -34,6 +34,7 @@
> > >      <docLabel>Web Documentation</docLabel>
> > >      <projectDir>/log4j-appserver</projectDir>
> > >      <tomcat.version>8.5.20</tomcat.version>
> > > +    <jetty.version>8.2.0.v20160908</jetty.version> <!--  Jetty 9
> > > requires Java 8 -->
> > >      <module.name>org.apache.logging.log4j.appserver</module.name>
> > >    </properties>
> > >
> > > @@ -56,6 +57,7 @@
> > >        <groupId>org.apache.tomcat</groupId>
> > >        <artifactId>tomcat-catalina</artifactId>
> > >        <version>${tomcat.version}</version>
> > > +      <scope>provided</scope>
> > >        <exclusions>
> > >          <exclusion>
> > >            <groupId>org.apache.tomcat</groupId>
> > > @@ -71,6 +73,12 @@
> > >          </exclusion>
> > >        </exclusions>
> > >      </dependency>
> > > +    <dependency>
> > > +      <groupId>org.eclipse.jetty</groupId>
> > > +      <artifactId>jetty-util</artifactId>
> > > +      <version>${jetty.version}</version>
> > > +      <scope>provided</scope>
> > > +    </dependency>
> > >
> > >      <!-- Test dependencies -->
> > >      <dependency>
> > >
> > > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> > > 7d52f131/log4j-appserver/src/main/java/org/apache/logging/
> > > log4j/appserver/jetty/Log4j2Logger.java
> > > ----------------------------------------------------------------------
> > > diff --git a/log4j-appserver/src/main/java/org/apache/logging/log4j/
> > > appserver/jetty/Log4j2Logger.java b/log4j-appserver/src/main/
> > > java/org/apache/logging/log4j/appserver/jetty/Log4j2Logger.java
> > > new file mode 100644
> > > index 0000000..7d1ce14
> > > --- /dev/null
> > > +++ b/log4j-appserver/src/main/java/org/apache/logging/log4j/
> > > appserver/jetty/Log4j2Logger.java
> > > @@ -0,0 +1,184 @@
> > > +/*
> > > + * Licensed to the Apache Software Foundation (ASF) under one or more
> > > + * contributor license agreements. See the NOTICE file distributed
> with
> > > + * this work for additional information regarding copyright ownership.
> > > + * The ASF licenses this file to You under the Apache license, Version
> > 2.0
> > > + * (the "License"); you may not use this file except in compliance
> with
> > > + * the License. You may obtain a copy of the License at
> > > + *
> > > + *      http://www.apache.org/licenses/LICENSE-2.0
> > > + *
> > > + * Unless required by applicable law or agreed to in writing, software
> > > + * distributed under the License is distributed on an "AS IS" BASIS,
> > > + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> > > implied.
> > > + * See the license for the specific language governing permissions and
> > > + * limitations under the license.
> > > + */
> > > +
> > > +package org.apache.logging.log4j.appserver.jetty;
> > > +
> > > +import org.apache.logging.log4j.LogManager;
> > > +import org.eclipse.jetty.util.log.AbstractLogger;
> > > +import org.eclipse.jetty.util.log.Logger;
> > > +
> > > +/**
> > > + * Provides a native Apache Log4j 2 for Jetty logging.
> > > + */
> > > +public class Log4j2Logger extends AbstractLogger {
> > > +
> > > +    private final org.apache.logging.log4j.Logger logger;
> > > +
> > > +    private final String name;
> > > +
> > > +    public Log4j2Logger(final String name) {
> > > +        super();
> > > +        this.name = name;
> > > +        this.logger = LogManager.getLogger(name);
> > > +    }
> > > +
> > > +    public Log4j2Logger() {
> > > +        this("");
> > > +    }
> > > +
> > > +    /*
> > > +     * (non-Javadoc)
> > > +     *
> > > +     * @see org.eclipse.jetty.util.log.Logger#debug(java.lang.String,
> > > java.lang.Object[])
> > > +     */
> > > +    @Override
> > > +    public void debug(final String msg, final Object... args) {
> > > +        logger.debug(msg, args);
> > > +    }
> > > +
> > > +    /*
> > > +     * (non-Javadoc)
> > > +     *
> > > +     * @see org.eclipse.jetty.util.log.Logger#debug(java.lang.String,
> > > java.lang.Throwable)
> > > +     */
> > > +    @Override
> > > +    public void debug(final String msg, final Throwable thrown) {
> > > +        logger.debug(msg, thrown);
> > > +    }
> > > +
> > > +    /*
> > > +     * (non-Javadoc)
> > > +     *
> > > +     * @see org.eclipse.jetty.util.log.Logger#debug(java.lang.
> > Throwable)
> > > +     */
> > > +    @Override
> > > +    public void debug(final Throwable thrown) {
> > > +        logger.debug(thrown);
> > > +    }
> > > +
> > > +    /*
> > > +     * (non-Javadoc)
> > > +     *
> > > +     * @see org.eclipse.jetty.util.log.Logger#getName()
> > > +     */
> > > +    @Override
> > > +    public String getName() {
> > > +        return name;
> > > +    }
> > > +
> > > +    /*
> > > +     * (non-Javadoc)
> > > +     *
> > > +     * @see org.eclipse.jetty.util.log.Logger#ignore(java.lang.
> > Throwable)
> > > +     */
> > > +    @Override
> > > +    public void ignore(final Throwable ignored) {
> > > +        // TODO Auto-generated method stub
> > > +
> > > +    }
> > > +
> > > +    /*
> > > +     * (non-Javadoc)
> > > +     *
> > > +     * @see org.eclipse.jetty.util.log.Logger#info(java.lang.String,
> > > java.lang.Object[])
> > > +     */
> > > +    @Override
> > > +    public void info(final String msg, final Object... args) {
> > > +        logger.info(msg, args);
> > > +    }
> > > +
> > > +    /*
> > > +     * (non-Javadoc)
> > > +     *
> > > +     * @see org.eclipse.jetty.util.log.Logger#info(java.lang.String,
> > > java.lang.Throwable)
> > > +     */
> > > +    @Override
> > > +    public void info(final String msg, final Throwable thrown) {
> > > +        logger.info(msg, thrown);
> > > +    }
> > > +
> > > +    /*
> > > +     * (non-Javadoc)
> > > +     *
> > > +     * @see org.eclipse.jetty.util.log.Logger#info(java.lang.
> Throwable)
> > > +     */
> > > +    @Override
> > > +    public void info(final Throwable thrown) {
> > > +        logger.info(thrown);
> > > +    }
> > > +
> > > +    /*
> > > +     * (non-Javadoc)
> > > +     *
> > > +     * @see org.eclipse.jetty.util.log.Logger#isDebugEnabled()
> > > +     */
> > > +    @Override
> > > +    public boolean isDebugEnabled() {
> > > +        return logger.isDebugEnabled();
> > > +    }
> > > +
> > > +    /*
> > > +     * (non-Javadoc)
> > > +     *
> > > +     * @see org.eclipse.jetty.util.log.AbstractLogger#newLogger(java.
> > > lang.String)
> > > +     */
> > > +    @Override
> > > +    protected Logger newLogger(final String fullname) {
> > > +        return new Log4j2Logger(fullname);
> > > +    }
> > > +
> > > +    /*
> > > +     * (non-Javadoc)
> > > +     *
> > > +     * @see org.eclipse.jetty.util.log.Logger#setDebugEnabled(
> boolean)
> > > +     */
> > > +    @Override
> > > +    public void setDebugEnabled(final boolean enabled) {
> > > +        warn("setDebugEnabled not implemented");
> > > +    }
> > > +
> > > +    /*
> > > +     * (non-Javadoc)
> > > +     *
> > > +     * @see org.eclipse.jetty.util.log.Logger#warn(java.lang.String,
> > > java.lang.Object[])
> > > +     */
> > > +    @Override
> > > +    public void warn(final String msg, final Object... args) {
> > > +        logger.warn(msg, args);
> > > +    }
> > > +
> > > +    /*
> > > +     * (non-Javadoc)
> > > +     *
> > > +     * @see org.eclipse.jetty.util.log.Logger#warn(java.lang.String,
> > > java.lang.Throwable)
> > > +     */
> > > +    @Override
> > > +    public void warn(final String msg, final Throwable thrown) {
> > > +        logger.warn(msg, thrown);
> > > +    }
> > > +
> > > +    /*
> > > +     * (non-Javadoc)
> > > +     *
> > > +     * @see org.eclipse.jetty.util.log.Logger#warn(java.lang.
> Throwable)
> > > +     */
> > > +    @Override
> > > +    public void warn(final Throwable thrown) {
> > > +        logger.warn(thrown);
> > > +    }
> > > +
> > > +}
> > >
> > > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> > > 7d52f131/src/changes/changes.xml
> > > ----------------------------------------------------------------------
> > > diff --git a/src/changes/changes.xml b/src/changes/changes.xml
> > > index 2bcefb2..070e4a1 100644
> > > --- a/src/changes/changes.xml
> > > +++ b/src/changes/changes.xml
> > > @@ -37,6 +37,9 @@
> > >        <action issue="LOG4J2-2103" dev="mikes" type="add">
> > >          XML encoding for PatternLayout.
> > >        </action>
> > > +      <action issue="LOG4J2-2114" dev="ggregory" type="add">
> > > +        Provide a native Log4j 2 implementation of Eclipse Jetty's
> > > org.eclipse.jetty.util.log.Logger.
> > > +      </action>
> > >        <action issue="LOG4J2-1203" dev="mikes" type="add"
> due-to="Robert
> > > Turner">
> > >          Allow filtering of line breaks in layout pattern.
> > >        </action>
> > >
> > >
> >
> >
> > --
> > Matt Sicker <bo...@gmail.com>
> >
>



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

Re: logging-log4j2 git commit: [LOG4J2-2114] Provide a native Log4j 2 implementation of Eclipse Jetty's org.eclipse.jetty.util.log.Logger.

Posted by Gary Gregory <ga...@gmail.com>.
I think you are correct...

Gary

On Fri, Nov 10, 2017 at 6:59 PM, Matt Sicker <bo...@gmail.com> wrote:

> Wouldn't this implementation contain incorrect caller location information?
>
> On 10 November 2017 at 19:25, <gg...@apache.org> wrote:
>
> > Repository: logging-log4j2
> > Updated Branches:
> >   refs/heads/master aad2f132b -> 7d52f131e
> >
> >
> > [LOG4J2-2114] Provide a native Log4j 2 implementation of Eclipse Jetty's
> > org.eclipse.jetty.util.log.Logger.
> >
> > Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
> > Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/
> > commit/7d52f131
> > Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/
> 7d52f131
> > Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/
> 7d52f131
> >
> > Branch: refs/heads/master
> > Commit: 7d52f131ec1e000834bcb40343f3f2d41805c75a
> > Parents: aad2f13
> > Author: Gary Gregory <gg...@apache.org>
> > Authored: Fri Nov 10 18:25:47 2017 -0700
> > Committer: Gary Gregory <gg...@apache.org>
> > Committed: Fri Nov 10 18:25:47 2017 -0700
> >
> > ----------------------------------------------------------------------
> >  log4j-appserver/pom.xml                         |   8 +
> >  .../log4j/appserver/jetty/Log4j2Logger.java     | 184
> +++++++++++++++++++
> >  src/changes/changes.xml                         |   3 +
> >  3 files changed, 195 insertions(+)
> > ----------------------------------------------------------------------
> >
> >
> > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> > 7d52f131/log4j-appserver/pom.xml
> > ----------------------------------------------------------------------
> > diff --git a/log4j-appserver/pom.xml b/log4j-appserver/pom.xml
> > index e96b1fc..6acd77b 100644
> > --- a/log4j-appserver/pom.xml
> > +++ b/log4j-appserver/pom.xml
> > @@ -34,6 +34,7 @@
> >      <docLabel>Web Documentation</docLabel>
> >      <projectDir>/log4j-appserver</projectDir>
> >      <tomcat.version>8.5.20</tomcat.version>
> > +    <jetty.version>8.2.0.v20160908</jetty.version> <!--  Jetty 9
> > requires Java 8 -->
> >      <module.name>org.apache.logging.log4j.appserver</module.name>
> >    </properties>
> >
> > @@ -56,6 +57,7 @@
> >        <groupId>org.apache.tomcat</groupId>
> >        <artifactId>tomcat-catalina</artifactId>
> >        <version>${tomcat.version}</version>
> > +      <scope>provided</scope>
> >        <exclusions>
> >          <exclusion>
> >            <groupId>org.apache.tomcat</groupId>
> > @@ -71,6 +73,12 @@
> >          </exclusion>
> >        </exclusions>
> >      </dependency>
> > +    <dependency>
> > +      <groupId>org.eclipse.jetty</groupId>
> > +      <artifactId>jetty-util</artifactId>
> > +      <version>${jetty.version}</version>
> > +      <scope>provided</scope>
> > +    </dependency>
> >
> >      <!-- Test dependencies -->
> >      <dependency>
> >
> > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> > 7d52f131/log4j-appserver/src/main/java/org/apache/logging/
> > log4j/appserver/jetty/Log4j2Logger.java
> > ----------------------------------------------------------------------
> > diff --git a/log4j-appserver/src/main/java/org/apache/logging/log4j/
> > appserver/jetty/Log4j2Logger.java b/log4j-appserver/src/main/
> > java/org/apache/logging/log4j/appserver/jetty/Log4j2Logger.java
> > new file mode 100644
> > index 0000000..7d1ce14
> > --- /dev/null
> > +++ b/log4j-appserver/src/main/java/org/apache/logging/log4j/
> > appserver/jetty/Log4j2Logger.java
> > @@ -0,0 +1,184 @@
> > +/*
> > + * Licensed to the Apache Software Foundation (ASF) under one or more
> > + * contributor license agreements. See the NOTICE file distributed with
> > + * this work for additional information regarding copyright ownership.
> > + * The ASF licenses this file to You under the Apache license, Version
> 2.0
> > + * (the "License"); you may not use this file except in compliance with
> > + * the License. You may obtain a copy of the License at
> > + *
> > + *      http://www.apache.org/licenses/LICENSE-2.0
> > + *
> > + * Unless required by applicable law or agreed to in writing, software
> > + * distributed under the License is distributed on an "AS IS" BASIS,
> > + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> > implied.
> > + * See the license for the specific language governing permissions and
> > + * limitations under the license.
> > + */
> > +
> > +package org.apache.logging.log4j.appserver.jetty;
> > +
> > +import org.apache.logging.log4j.LogManager;
> > +import org.eclipse.jetty.util.log.AbstractLogger;
> > +import org.eclipse.jetty.util.log.Logger;
> > +
> > +/**
> > + * Provides a native Apache Log4j 2 for Jetty logging.
> > + */
> > +public class Log4j2Logger extends AbstractLogger {
> > +
> > +    private final org.apache.logging.log4j.Logger logger;
> > +
> > +    private final String name;
> > +
> > +    public Log4j2Logger(final String name) {
> > +        super();
> > +        this.name = name;
> > +        this.logger = LogManager.getLogger(name);
> > +    }
> > +
> > +    public Log4j2Logger() {
> > +        this("");
> > +    }
> > +
> > +    /*
> > +     * (non-Javadoc)
> > +     *
> > +     * @see org.eclipse.jetty.util.log.Logger#debug(java.lang.String,
> > java.lang.Object[])
> > +     */
> > +    @Override
> > +    public void debug(final String msg, final Object... args) {
> > +        logger.debug(msg, args);
> > +    }
> > +
> > +    /*
> > +     * (non-Javadoc)
> > +     *
> > +     * @see org.eclipse.jetty.util.log.Logger#debug(java.lang.String,
> > java.lang.Throwable)
> > +     */
> > +    @Override
> > +    public void debug(final String msg, final Throwable thrown) {
> > +        logger.debug(msg, thrown);
> > +    }
> > +
> > +    /*
> > +     * (non-Javadoc)
> > +     *
> > +     * @see org.eclipse.jetty.util.log.Logger#debug(java.lang.
> Throwable)
> > +     */
> > +    @Override
> > +    public void debug(final Throwable thrown) {
> > +        logger.debug(thrown);
> > +    }
> > +
> > +    /*
> > +     * (non-Javadoc)
> > +     *
> > +     * @see org.eclipse.jetty.util.log.Logger#getName()
> > +     */
> > +    @Override
> > +    public String getName() {
> > +        return name;
> > +    }
> > +
> > +    /*
> > +     * (non-Javadoc)
> > +     *
> > +     * @see org.eclipse.jetty.util.log.Logger#ignore(java.lang.
> Throwable)
> > +     */
> > +    @Override
> > +    public void ignore(final Throwable ignored) {
> > +        // TODO Auto-generated method stub
> > +
> > +    }
> > +
> > +    /*
> > +     * (non-Javadoc)
> > +     *
> > +     * @see org.eclipse.jetty.util.log.Logger#info(java.lang.String,
> > java.lang.Object[])
> > +     */
> > +    @Override
> > +    public void info(final String msg, final Object... args) {
> > +        logger.info(msg, args);
> > +    }
> > +
> > +    /*
> > +     * (non-Javadoc)
> > +     *
> > +     * @see org.eclipse.jetty.util.log.Logger#info(java.lang.String,
> > java.lang.Throwable)
> > +     */
> > +    @Override
> > +    public void info(final String msg, final Throwable thrown) {
> > +        logger.info(msg, thrown);
> > +    }
> > +
> > +    /*
> > +     * (non-Javadoc)
> > +     *
> > +     * @see org.eclipse.jetty.util.log.Logger#info(java.lang.Throwable)
> > +     */
> > +    @Override
> > +    public void info(final Throwable thrown) {
> > +        logger.info(thrown);
> > +    }
> > +
> > +    /*
> > +     * (non-Javadoc)
> > +     *
> > +     * @see org.eclipse.jetty.util.log.Logger#isDebugEnabled()
> > +     */
> > +    @Override
> > +    public boolean isDebugEnabled() {
> > +        return logger.isDebugEnabled();
> > +    }
> > +
> > +    /*
> > +     * (non-Javadoc)
> > +     *
> > +     * @see org.eclipse.jetty.util.log.AbstractLogger#newLogger(java.
> > lang.String)
> > +     */
> > +    @Override
> > +    protected Logger newLogger(final String fullname) {
> > +        return new Log4j2Logger(fullname);
> > +    }
> > +
> > +    /*
> > +     * (non-Javadoc)
> > +     *
> > +     * @see org.eclipse.jetty.util.log.Logger#setDebugEnabled(boolean)
> > +     */
> > +    @Override
> > +    public void setDebugEnabled(final boolean enabled) {
> > +        warn("setDebugEnabled not implemented");
> > +    }
> > +
> > +    /*
> > +     * (non-Javadoc)
> > +     *
> > +     * @see org.eclipse.jetty.util.log.Logger#warn(java.lang.String,
> > java.lang.Object[])
> > +     */
> > +    @Override
> > +    public void warn(final String msg, final Object... args) {
> > +        logger.warn(msg, args);
> > +    }
> > +
> > +    /*
> > +     * (non-Javadoc)
> > +     *
> > +     * @see org.eclipse.jetty.util.log.Logger#warn(java.lang.String,
> > java.lang.Throwable)
> > +     */
> > +    @Override
> > +    public void warn(final String msg, final Throwable thrown) {
> > +        logger.warn(msg, thrown);
> > +    }
> > +
> > +    /*
> > +     * (non-Javadoc)
> > +     *
> > +     * @see org.eclipse.jetty.util.log.Logger#warn(java.lang.Throwable)
> > +     */
> > +    @Override
> > +    public void warn(final Throwable thrown) {
> > +        logger.warn(thrown);
> > +    }
> > +
> > +}
> >
> > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/
> > 7d52f131/src/changes/changes.xml
> > ----------------------------------------------------------------------
> > diff --git a/src/changes/changes.xml b/src/changes/changes.xml
> > index 2bcefb2..070e4a1 100644
> > --- a/src/changes/changes.xml
> > +++ b/src/changes/changes.xml
> > @@ -37,6 +37,9 @@
> >        <action issue="LOG4J2-2103" dev="mikes" type="add">
> >          XML encoding for PatternLayout.
> >        </action>
> > +      <action issue="LOG4J2-2114" dev="ggregory" type="add">
> > +        Provide a native Log4j 2 implementation of Eclipse Jetty's
> > org.eclipse.jetty.util.log.Logger.
> > +      </action>
> >        <action issue="LOG4J2-1203" dev="mikes" type="add" due-to="Robert
> > Turner">
> >          Allow filtering of line breaks in layout pattern.
> >        </action>
> >
> >
>
>
> --
> Matt Sicker <bo...@gmail.com>
>