clean log code

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/content-management/storage-manager-trigger@100632 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
roberto.cirillo 2014-10-13 10:47:28 +00:00
parent e818f29879
commit 165ad4ee13
4 changed files with 20 additions and 15 deletions

View File

@ -75,7 +75,7 @@ public class ReadingMongoOplog extends Thread{
if(x.containsField("o")){
c.put(x);
// parser.runWithoutThread(x);
logger.info("Producer #" + this.number + " put: " + x);
logger.debug("Producer #" + this.number + " put: " + x);
}else{
logger.debug("operation is not accounted");
}

View File

@ -81,7 +81,7 @@ public class JsonParser extends Thread{
MongoDB mongo=null;
try{
x=c.get();
logger.info("Consumer #" + this.number + " got: " + x);
logger.debug("Consumer #" + this.number + " got: " + x);
op = (String) x.get("op");
// retrieve object fields
DBObject obj=(DBObject)x.get("o");
@ -89,7 +89,7 @@ public class JsonParser extends Thread{
// set object dimension
long length=-1;
if(obj.get("length")!=null) length=(long)obj.get("length");
logger.info("[recordCheck] operation: "+op+" name: "+name+" type: "+type+" path: "+filename+" length: "+length+" owner: "+owner+"\n\t cretionTime: "+creationTime+ " lastOperation "+lastOperation+" lastUser: "+lastUser+" lastAccess: "+lastAccess);
logger.debug("[recordCheck] operation: "+op+" name: "+name+" type: "+type+" path: "+filename+" length: "+length+" owner: "+owner+"\n\t cretionTime: "+creationTime+ " lastOperation "+lastOperation+" lastUser: "+lastUser+" lastAccess: "+lastAccess);
if(((length >0) && (((filename!=null) && (filename.contains("/"))) || (linkCount > 0)))){
//convert from byte to kb
length=length/1024;
@ -115,11 +115,16 @@ public class JsonParser extends Thread{
}
// if the lastoperation is download and the caller contains a dts host then it isn't a real user but it is a workspace accounting record
if(lastOperation != null && lastOperation.equalsIgnoreCase("DOWNLOAD")){
logger.debug("check if the caller is from dts. CallerIP: "+callerIp);
for(String host: dtsHosts){
if(host.contains(callerIp))
logger.debug("scan "+host);
if(callerIp.contains(host)){
lastUser="workspace.accounting";
logger.info("the caller is dts service: caller "+callerIp+ " dts host: "+host+" the new user is: "+lastUser);
}
}
}
logger.debug(" operation accounted "+lastOperation);
StorageStatusRecord ssr=null;
if(isNeedSSReport(lastOperation)){
try{
@ -133,7 +138,7 @@ public class JsonParser extends Thread{
}
}
try{
logger.info(" operation accounted "+lastOperation);
//call to the accounting library
if (ssr !=null)
report( filename, owner, creationTime, length, scope, lastOperation, callerIp, lastAccess, lastUser, ssr.getVolume()+"", ssr.getCount()+"");
@ -144,10 +149,10 @@ public class JsonParser extends Thread{
}
// logger.info("\n[accountingCall] operation: "+lastOperation+"\n\t name: "+name+"\n\t type: "+type+"\n\t path: "+filename+"\n\t length: "+length+"\n\t owner: "+owner+"\n\t cretionTime: "+creationTime+"\n\t scope: "+scope+"\n\t lastOperation "+lastOperation+"\n\t lastUser: "+lastUser+"\n\t lastAccess: "+lastAccess+"\n\t callerIp: "+callerIp);
}else{
logger.info("operation is not accounted: invalid scope: "+scope);
logger.info("operation "+lastOperation+" is not accounted: invalid scope: "+scope);
}
}else{
logger.info("operation is not accounted");
logger.info("operation "+lastOperation+" is not accounted");
}
}catch(Exception e){

View File

@ -96,19 +96,19 @@ public class Configuration {
Map<String, Property>map= ap.propertyMap();
Property type=map.get("type");
backendType=type.value();
logger.info("Type of backend found "+backendType);
logger.debug("Type of backend found "+backendType);
return server;
}
private String[] getServers(List<ServiceEndpoint> resources) {
ServiceEndpoint defaultResource=null;
logger.info("search RR with priority ");
logger.debug("search RR with priority ");
// search RR with property DEFAULT
for (ServiceEndpoint res : resources){
String priority=retrievePropertyValue(res, "priority");
if (priority!=null){
defaultResource=res;
logger.info("found a RR with priority: ");
logger.debug("found a RR with priority: ");
break;
}
}
@ -133,7 +133,7 @@ public class Configuration {
}
}
backendType=retrievePropertyValue(defaultResource, "type");
logger.info("Type of backend found in RR is "+backendType);
logger.debug("Type of backend found in RR is "+backendType);
return server;
}else{

View File

@ -126,7 +126,7 @@ public class MongoDB {
}else if(operation.equalsIgnoreCase("DELETE")){
currentVolume=currentVolume-volume;
}
logger.info("new current volume "+currentVolume);
logger.info("new volume "+currentVolume);
return currentVolume;
}
@ -136,7 +136,7 @@ public class MongoDB {
currentCount=currentCount+count;
else if(operation.equalsIgnoreCase("DELETE"))
currentCount=currentCount-count;
logger.info("new count calculated: "+currentCount);
logger.info("new count: "+currentCount);
return currentCount;
}
@ -173,8 +173,8 @@ public class MongoDB {
if(user==null) user="";
if(pwd==null) pwd="";
boolean auth = db.authenticate(user, pwd.toCharArray());
if(auth) logger.info("mongo is in authenticate mode");
else logger.info("mongo is not in authenticate mode");
if(auth) logger.debug("mongo is in authenticate mode");
else logger.debug("mongo is not in authenticate mode");
if(ssCollection == null)
ssCollection=db.getCollection(collection);
ssCollection.findOne();