[
https://issues.apache.org/jira/browse/OOZIE-2504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15228094#comment-15228094
]
Harsh J commented on OOZIE-2504:
--------------------------------
Windows manual test run (first run of script uses the file exist check and the
line counter, and second run just uses file exist check, just like the added
tests in patch):
{code}
C:\Users\test1\Desktop>type script.bat
IF EXIST %HADOOP_CONF_DIR%\log4j.properties ECHO L4J_EXISTS=yes
SET COMMAND="type %HADOOP_CONF_DIR%\log4j.properties | FIND /c /v
"~DOESNOTMATCH~""
FOR /f %%i IN (' %COMMAND% ') DO SET L4J_LC=%%i
echo L4J_WC=%L4J_LC%
C:\Users\test1\Desktop>echo %HADOOP_CONF_DIR%
C:\Users\test1\some-conf-dir
C:\Users\test1\Desktop>dir %HADOOP_CONF_DIR%
04/06/2016 04:14 AM <DIR> .
04/06/2016 04:14 AM <DIR> ..
04/06/2016 04:14 AM 3 log4j.properties
1 File(s) 3 bytes
C:\Users\test1\Desktop>script
C:\Users\test1\Desktop>IF EXIST C:\Users\test1\some-conf-dir\log4j.properties
ECHO L4J_EXISTS=yes
L4J_EXISTS=yes
C:\Users\test1\Desktop>SET COMMAND="type
C:\Users\test1\some-conf-dir\log4j.properties | FIND /c /v "~DOESNOTMATCH~""
C:\Users\test1\Desktop>FOR /F %i IN (' "type
C:\Users\test1\some-conf-dir\log4j.properties | FIND /c /v "~DOESNOTMATCH~"
" ') DO SET L4J_LC=%i
C:\Users\test1\Desktop>SET L4J_LC=1
C:\Users\test1\Desktop>echo L4J_WC=1
L4J_WC=1
C:\Users\test1\Desktop>mkdir ..\empty-dir
C:\Users\test1\Desktop>SET HADOOP_CONF_DIR=C:\Users\test1\empty-dir
C:\Users\test1\Desktop>script
C:\Users\test1\Desktop>IF EXIST C:\Users\test1\empty-dir\log4j.properties ECHO
L4J_EXISTS=yes
C:\Users\test1\Desktop>
{code}
> Create a log4j.properties under HADOOP_CONF_DIR in Shell Action
> ---------------------------------------------------------------
>
> Key: OOZIE-2504
> URL: https://issues.apache.org/jira/browse/OOZIE-2504
> Project: Oozie
> Issue Type: Improvement
> Components: action
> Affects Versions: trunk
> Reporter: Harsh J
> Assignee: Harsh J
> Priority: Minor
> Attachments: OOZIE-2504.000.patch
>
>
> We currently do environment exports of {{HADOOP_CONF_DIR}} and
> {{YARN_CONF_DIR}}, when the feature of config directory is enabled, for
> catering to people wanting to use {{hadoop}} or such relying commands, and
> this works well.
> However, an issue occurs when {{<capture-output/>}} is enabled, wherein the
> commands, not finding a logger configuration, start using {{System.out}} by
> default [1], and any/all lines that match the capture output criteria from
> the log-spam in {{System.out}} make it into the captured results, which can
> break further logic done in subsequent actions relying on proper captured
> values.
> We can fix this by pre-preparing, optionally, a {{log4j.properties}} file
> under {{HADOOP_CONF_DIR}} and {{YARN_CONF_DIR}}, such that the commands use
> that logging configuration and write logs into {{System.err}} by default.
> [1] -
> https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/ConsoleAppender.html
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)