logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steffen Offermann (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (LOG4J2-1573) Layout is no longer optional
Date Fri, 09 Sep 2016 08:57:21 GMT

    [ https://issues.apache.org/jira/browse/LOG4J2-1573?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15476393#comment-15476393
] 

Steffen Offermann edited comment on LOG4J2-1573 at 9/9/16 8:56 AM:
-------------------------------------------------------------------

Test case:

{code}
import java.util.concurrent.TimeUnit;

import org.junit.After;
import org.junit.Test;

import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.config.Configurator;

import static org.hamcrest.MatcherAssert.assertThat;

import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.nullValue;

public class TestForLog4j2_Jira1573
{
   @After
   public void tearDown()
   {
      Configurator.shutdown( null, 10L, TimeUnit.SECONDS );
   }

   @Test
   public void verifyThatAsyncAppendersAreAvailable()
   {
      final LoggerContext context = Configurator.initialize( "foo", "log4j2-xml-async.xml"
);

      assertThat( context, not( nullValue() ) );

      context.start();
      context.getLogger( "" ).info( "Test" );
      context.stop();
   }
}
{code}


was (Author: steffeno):
Test case:

{code}
import java.util.concurrent.TimeUnit;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.config.Configurator;

import static org.hamcrest.MatcherAssert.assertThat;

import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.nullValue;

public class TestForLog4j2_Jira1573
{
   @After
   public void tearDown()
   {
      Configurator.shutdown( null, 10L, TimeUnit.SECONDS );
   }

   @Test
   public void verifyThatAsyncAppendersAreAvailable()
   {
      final LoggerContext context = Configurator.initialize( "foo", "log4j2-xml-async.xml"
);

      assertThat( context, not( nullValue() ) );

      context.start();
      context.getLogger( "" ).info( "Test" );
      context.stop();
   }
}
{code}

> Layout is no longer optional
> ----------------------------
>
>                 Key: LOG4J2-1573
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1573
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 2.7
>            Reporter: Steffen Offermann
>            Priority: Minor
>
> This configuration used to work in 2.6.2:
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <Configuration status="warn" packages="com.aixigo.tec.logging">
>    <Appenders>
>       <Console name="myConsole" target="SYSTEM_OUT"/>
>       <Async name="myConsoleAsync">
>          <AppenderRef ref="myConsole" />
>       </Async>
>    </Appenders>
>    <Loggers>
>       <AsyncRoot level="info" />
>    </Loggers>
> </Configuration>
> {code}
> With the current {{master}} (i.e. the upcoming 2.7) this does not work any more. The
validator complains because the field "layout" is missing in
> {code:xml}
>  <Console name="myConsole" target="SYSTEM_OUT" />
> {code}
> According to the current documentation this is a bug:
> ||Parameter Name||Type||	Description||
> | layout | Layout | The Layout to use to format the LogEvent. If no layout is supplied
the default pattern layout of "%m%n" will be used.
> With this configuration it works:
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <Configuration status="warn" packages="com.aixigo.tec.logging">
>    <Appenders>
>       <Console name="myConsole" target="SYSTEM_OUT">
>          <DetailsLayout/>
>       </Console>
>       <Async name="myConsoleAsync">
>          <AppenderRef ref="myConsole" />
>       </Async>
>    </Appenders>
>    <Loggers>
>       <AsyncRoot level="info" />
>    </Loggers>
> </Configuration>
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message