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

Duo Zhang commented on HADOOP-16206:
------------------------------------

The converted log4j2.xml has some problems. The biggest  problem is that, there 
is no direct mapping for the configuration style 
'log4j.rootLogger=INFO,console'.

In log4j2, you have to set level and appender separately.

In HBase, we keep the config in hbase-env.sh the same, but in bin/hbase, we 
split the property and pass level and appender with difference system 
properties, i.e, two '-Dxxx', to the actual java process.

This is an example: 
https://github.com/apache/hbase/blob/a4d954e60645f2c81d53c2081d90ea9c175314dc/conf/log4j2.xml#L76

{code}
    <Root level="${sys:hbase.root.logger.level:-info}">
      <AppenderRef ref="${sys:hbase.root.logger.appender:-console}" />
    </Root>
{code}

This is where I split the config: 
https://github.com/apache/hbase/blob/a4d954e60645f2c81d53c2081d90ea9c175314dc/bin/hbase#L793
{code}
# log4j2 does not support setting log level and appender at once, so we need to 
split HBASE_ROOT_LOGGER
HBASE_ROOT_LOGGER=${HBASE_ROOT_LOGGER:-INFO,console}
array=(${HBASE_ROOT_LOGGER//,/ })
HBASE_OPTS="$HBASE_OPTS -Dhbase.root.logger.level=${array[0]}"
HBASE_OPTS="$HBASE_OPTS -Dhbase.root.logger.appender=${array[1]}"
{code}

In hadoop, we also need to find a way to deal with this. 

> Migrate from Log4j1 to Log4j2
> -----------------------------
>
>                 Key: HADOOP-16206
>                 URL: https://issues.apache.org/jira/browse/HADOOP-16206
>             Project: Hadoop Common
>          Issue Type: Sub-task
>    Affects Versions: 3.3.0
>            Reporter: Akira Ajisaka
>            Assignee: Duo Zhang
>            Priority: Major
>         Attachments: HADOOP-16206-wip.001.patch
>
>
> This sub-task is to remove log4j1 dependency and add log4j2 dependency.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to