logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Remko Popma (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LOG4J2-726) logging hang when PatternLayout's pattern has miss pattern
Date Sun, 10 Aug 2014 08:24:11 GMT

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

Remko Popma commented on LOG4J2-726:
------------------------------------

Interestingly, this does not happen if the pattern has only one '\{' character, like {{<PatternLayout
pattern="%d\{HH:mm:ss.SSS  - %msg%n"/>}}: in this case the application will not hang. The
app hangs only when the pattern has two or more opening  '\{' characters but not enough closing
 '\}' characters.

> logging hang when PatternLayout's pattern has miss pattern
> ----------------------------------------------------------
>
>                 Key: LOG4J2-726
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-726
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Configurators
>    Affects Versions: 2.0
>         Environment: windows 8.1 64bit
> java 1.7.0_55 64bit 
> log4j2 2.0
>            Reporter: moonumi
>            Assignee: Remko Popma
>             Fix For: 2.0.2
>
>
> {code}
> <?xml version="1.0" encoding="UTF-8"?>
> <Configuration status="WARN">
>   <Appenders>
>     <Console name="Console" target="SYSTEM_OUT">
>       <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
>     </Console>
>   </Appenders>
>   <Loggers>
>     <Logger name="com.foo.Bar" level="trace" additivity="false">
>       <AppenderRef ref="Console"/>
>     </Logger>
>     <Root level="error">
>       <AppenderRef ref="Console"/>
>     </Root>
>   </Loggers>
> </Configuration>
> {code}
> The above configuration syntax is correct. However, if one makes a mistake and instead
writes:
> {code}
> <PatternLayout pattern="%d\{HH:mm:ss.SSS  [%t] %-5level %logger\{36\} - %msg%n"/>
> {code}
> Note the ommited character "\}" in the date pattern.
> Run sample application.
> This will hang log4j2 logging system.
> sample source code:
> {code}
> import org.apache.logging.log4j.LogManager;
> import org.apache.logging.log4j.Logger;
>  
> public class HelloWorld {
>     private static Logger logger = LogManager.getLogger("HelloWorld");
>     public static void main(String[] args) {
>         logger.info("Hello, World!");
>     }
> }
> {code}
> appear pattern configuration error or logging print miss pattern.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

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