Skip to content

Commit 1363420

Browse files
committed
Merge pull request #24 from jayunit100/master
BZ_921232
2 parents 89f1782 + 0fdde4d commit 1363420

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

pom.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@
1818
<artifactId>hadoop-core</artifactId>
1919
<version>0.20.2</version>
2020
</dependency>
21+
<dependency>
22+
<groupId>org.slf4j</groupId>
23+
<artifactId>slf4j-api</artifactId>
24+
<version>1.5.8</version>
25+
<scope>compile</scope>
26+
</dependency>
27+
<dependency>
28+
<groupId>org.slf4j</groupId>
29+
<artifactId>slf4j-log4j12</artifactId>
30+
<version>1.7.3</version>
31+
</dependency>
2132
</dependencies>
2233
<build>
2334
<plugins>

src/main/java/org/apache/hadoop/fs/glusterfs/GlusterFileSystem.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
import org.apache.hadoop.util.Shell;
4444
import org.apache.hadoop.util.StringUtils;
4545

46+
import org.slf4j.Logger;
47+
import org.slf4j.LoggerFactory;
48+
4649
/*
4750
* This package provides interface for hadoop jobs (incl. Map/Reduce)
4851
* to access files in GlusterFS backed file system via FUSE mount
@@ -54,13 +57,16 @@
5457
*
5558
*/
5659
public class GlusterFileSystem extends FileSystem{
60+
61+
static final Logger log = LoggerFactory.getLogger(GlusterFileSystem.class);
5762

5863
private FileSystem glusterFs=null;
5964
private URI uri=null;
6065
private Path workingDir=null;
6166
private String glusterMount=null;
6267
private boolean mounted=false;
6368

69+
6470
/* for quick IO */
6571
private boolean quickSlaveIO=false;
6672

@@ -86,14 +92,14 @@ public boolean FUSEMount(String volname,String server,String mount) throws IOExc
8692
String mountCmd=null;
8793

8894
mountCmd="mount -t glusterfs "+server+":"+"/"+volname+" "+mount;
89-
System.out.println(mountCmd);
95+
log.info(mountCmd);
9096
try{
9197
p=Runtime.getRuntime().exec(mountCmd);
9298
retVal=p.waitFor();
9399
if(retVal!=0)
94100
ret=false;
95101
}catch (IOException e){
96-
System.out.println("Problem mounting FUSE mount on: "+mount);
102+
log.info("Problem mounting FUSE mount on: "+mount);
97103
throw new RuntimeException(e);
98104
}
99105
return ret;
@@ -109,7 +115,7 @@ public void initialize(URI uri,Configuration conf) throws IOException{
109115
if(this.mounted)
110116
return;
111117

112-
System.out.println("Initializing GlusterFS");
118+
log.info("Initializing GlusterFS");
113119

114120
try{
115121
volName=conf.get("fs.glusterfs.volname", null);
@@ -314,7 +320,7 @@ private void loadPermissionInfo(){
314320
String output;
315321
StringTokenizer t=new StringTokenizer(output=execCommand(theFile, Shell.getGET_PERMISSION_COMMAND()));
316322

317-
// System.out.println("Output of PERMISSION command = " + output
323+
// log.info("Output of PERMISSION command = " + output
318324
// + " for " + this.getPath());
319325
// expected format
320326
// -rw------- 1 username groupname ...
@@ -546,7 +552,7 @@ public BlockLocation[] getFileBlockLocations(FileStatus file,long start,long len
546552

547553
result=xattr.getPathInfo(f.getPath(), start, len);
548554
if(result==null){
549-
System.out.println("Problem getting destination host for file "+f.getPath());
555+
log.info("Problem getting destination host for file "+f.getPath());
550556
return null;
551557
}
552558

0 commit comments

Comments
 (0)