You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Matyas Orhidi (JIRA)" <ji...@apache.org> on 2016/04/29 14:56:12 UTC

[jira] [Commented] (HIVE-10502) Cannot specify log4j.properties file location in Beeline

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

Matyas Orhidi commented on HIVE-10502:
--------------------------------------

Here is an option that worked for me:

1) Created a log4j config in a folder. (should be beeline-log4j.properties exactly)

/root/mypreferredclasses/beeline-log4j.properties

--

log4j.rootLogger=TRACE, console

######## console appender ########
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.target=System.err
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=### magic here ### %d{yy/MM/dd HH:mm:ss} [%t]: %p %c{2}: %m%n
log4j.appender.console.encoding=UTF-8

2) Called the beeline command by adding this folder into the beginning of the beeline classpath:
export HADOOP_USER_CLASSPATH_FIRST=true; export HADOOP_CLASSPATH=/root/mypreferredclasses; beeline -u jdbc:hive2://nosuchhost:10000
scan complete in 2ms
Connecting to jdbc:hive2://nosuchhost:10000
### magic here ### 16/04/29 05:44:42 [main]: INFO jdbc.Utils: Supplied authorities: nosuchhost:10000
### magic here ### 16/04/29 05:44:42 [main]: INFO jdbc.Utils: Resolved authority: nosuchhost:10000
### magic here ### 16/04/29 05:44:42 [main]: INFO jdbc.HiveConnection: Will try to open client transport with JDBC Uri: jdbc:hive2://nosuchhost:10000
### magic here ### 16/04/29 05:44:42 [main]: DEBUG transport.TSaslTransport: opening transport org.apache.thrift.transport.TSaslClientTransport@2977cbf7
### magic here ### 16/04/29 05:44:42 [main]: INFO jdbc.HiveConnection: Could not open client transport with JDBC Uri: jdbc:hive2://nosuchhost:10000
Error: Could not open client transport with JDBC Uri: jdbc:hive2://nosuchhost:10000: java.net.UnknownHostException: nosuchhost (state=08S01,code=0)
Beeline version 1.1.0-cdh5.4.5 by Apache Hive
0: jdbc:hive2://nosuchhost:10000 (closed)>

> Cannot specify log4j.properties file location in Beeline
> --------------------------------------------------------
>
>                 Key: HIVE-10502
>                 URL: https://issues.apache.org/jira/browse/HIVE-10502
>             Project: Hive
>          Issue Type: Bug
>          Components: Beeline
>    Affects Versions: 1.1.0
>            Reporter: Szehon Ho
>            Assignee: Chaoyu Tang
>
> In HiveCLI, HiveServer2, HMS, etc, the following is called early in the startup to initialize log4j logging: LogUtils.initHiveLog4j().
> However, seems like this is not the case in Beeline, which also needs log4j like as follows:
> {noformat}
>   at org.apache.log4j.LogManager.<clinit>(LogManager.java:127)
>   at org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:66)
>   at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:270)
>   at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:156)
>   at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:132)
>   at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:657)
>   at org.apache.hadoop.util.VersionInfo.<clinit>(VersionInfo.java:37)
> {noformat}
> It would be good to specify it, so it doesn't pick the first one in the classpath.



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