use of org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender in project hive by apache.
the class HttpServer method getLogDir.
String getLogDir(Configuration conf) {
String logDir = conf.get("hive.log.dir");
if (logDir == null) {
logDir = System.getProperty("hive.log.dir");
}
if (logDir != null) {
return logDir;
}
LoggerContext context = (LoggerContext) LogManager.getContext(false);
for (Logger logger : context.getLoggers()) {
for (Appender appender : logger.getAppenders().values()) {
if (appender instanceof AbstractOutputStreamAppender) {
OutputStreamManager manager = ((AbstractOutputStreamAppender<?>) appender).getManager();
if (manager instanceof FileManager) {
String fileName = ((FileManager) manager).getFileName();
if (fileName != null) {
return fileName.substring(0, fileName.lastIndexOf('/'));
}
}
}
}
}
return null;
}
Aggregations