MCPcopy Create free account
hub / github.com/apache/pig / log4jConfAsProperties

Method log4jConfAsProperties

src/org/apache/pig/Main.java:802–830  ·  view source on GitHub ↗
(String log4jconf)

Source from the content-addressed store, hash-verified

800 }
801
802 @VisibleForTesting
803 static Properties log4jConfAsProperties(String log4jconf) {
804 final Properties properties = new Properties();
805 if (!Strings.isNullOrEmpty(log4jconf)) {
806 Reader propertyReader = null;
807 try {
808 final File file = new File(log4jconf);
809 if (file.exists()) {
810 propertyReader = new FileReader(file);
811 properties.load(propertyReader);
812 log.info("Loaded log4j properties from file: " + file);
813 } else {
814 final URL resource = Main.class.getClassLoader().getResource(log4jconf);
815 if (resource != null) {
816 propertyReader = new InputStreamReader(resource.openStream(), Charset.forName("UTF-8"));
817 properties.load(propertyReader);
818 log.info("Loaded log4j properties from resource: " + resource);
819 } else {
820 log.warn("No file or resource found by the name: " + log4jconf);
821 }
822 }
823 } catch (IOException e) {
824 log.warn("Cannot open log4j properties file " + log4jconf + ", using default");
825 } finally {
826 Closeables.closeQuietly(propertyReader);
827 }
828 }
829 return properties;
830 }
831
832 private static List<String> fetchRemoteParamFiles(List<String> paramFiles, Properties properties)
833 throws IOException {

Callers 2

testlog4jConfMethod · 0.95
configureLog4JMethod · 0.95

Calls 5

infoMethod · 0.80
getClassLoaderMethod · 0.80
existsMethod · 0.65
warnMethod · 0.65
loadMethod · 0.45

Tested by 1

testlog4jConfMethod · 0.76